diff --git "a/\345\217\266\344\277\212\346\235\260/20241205 \345\210\235\350\257\206maven.md" "b/\345\217\266\344\277\212\346\235\260/20241205 \345\210\235\350\257\206maven.md" new file mode 100644 index 0000000000000000000000000000000000000000..ac28b3cafea7aa1a72e56a716aaa519b7e545ef3 --- /dev/null +++ "b/\345\217\266\344\277\212\346\235\260/20241205 \345\210\235\350\257\206maven.md" @@ -0,0 +1,90 @@ +# 一、笔记部分 + +## Maven 的使用流程 + +### 1. 下载Maven + +- 前往 [Welcome to Apache Maven – Maven](https://gitee.com/link?target=https%3A%2F%2Fmaven.apache.org%2F) 官网 + +- 点击 “Download” 进入下载页面,如下图 + + ![image-20241205102546798](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733365551.png) + +- 选择 Windows 系统适用的已构建好的成品 + + ![image-20241205102750129](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733365671.png) + +### 2. 配置Maven + +#### 2.1 解压并放到个人所好的目录下 + +![image-20241205103029148](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733365831.png) + +#### 2.2 配置阿里云镜像提高下载速度 + +- 打开 maven 的配置文件 >> (...\apache-maven-3.9.9\conf\settings.xml) + +![image-20241205103338292](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733366020.png) + +- 将 阿里云镜像 配置写入 `` 镜像配置内 + +``` + + alimaven + central + 阿里云公共仓库 + https://maven.aliyun.com/repository/public + +``` + +![image-20241205103549692](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733366150.png) + +#### 2.3 配置本地maven仓库 + +- 设置maven下载的依赖所在的文件夹 + +![image-20241205104317234](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733366598.png) + +#### 2.4 配置IDEA + +- 找到IDEA设置内的 Maven | 根据个人设置下图选项 + +![image-20241205105139958](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733367103.png) + +### 3. 新建 Maven构建 项目 + +#### 3.1 在 IDEA 新建项目中选择Maven构建系统 + +![image-20241205110004275](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733367605.png) + +创建后将会自带执行maven基本构建,且下图的几个标志性文件/功能 + +![image-20241205112442581](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733369083.png) + +#### 3.2 通过maven 配置项目依赖库 + +- 访问 [maven]([Maven Repository: Search/Browse/Explore](https://gitee.com/link?target=https%3A%2F%2Fmvnrepository.com%2F)) 依赖官网,搜索所需依赖 + +![image-20241205124022685](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733373624.png) + +- 选择依赖的版本 + +![image-20241205124118103](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733373679.png) + +- 复制依赖配置代码 + +![image-20241205124308156](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733373790.png) + +- 写入项目的`pom.xml`配置文件,并重载依赖 + +![image-20241205124457940](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733373899.png) + +- 后在 maven 处查看依赖项是否正确加载 + +![image-20241205124634048](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733373995.png) + +# 二、作业部分 + +## 使用maven构建系统来查询数据库 + +![image-20241205130351520](https://gitee.com/Bluesky-kk/my-pic/raw/master/img/upgit_20241205_1733375032.png) \ No newline at end of file