1.百度下载maven,windows下载bin.zip
https://maven.apache.org/download.cgi
2.解压到硬盘,配置maven
解压的maven目录下的conf-->setting.xml
在setting.xml中搜索localRepository,在下面自己添加一行设置本地仓库位置
<localRepository>D:/F/Program Files/JetBrains/apache-maven-3.6.3/pepo</localRepository>
![图片](https://img-blog.csdnimg.cn/20201224204115997.png#pic_center)
远程仓库为阿里云仓库s
在setting.xml中搜索mirrors,在里面自己添加远程仓库配置
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
![图片](https://img-blog.csdnimg.cn/2020122420450914.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjA2NjQ0NQ==,size_16,color_FFFFFF,t_70)
3.打开idea设置maven到本地maven
setting-->搜索maven
搜索不到就是idea没下maven,setting-->Plugins,在Plugins中搜索maven下载
![图片](https://img-blog.csdnimg.cn/20201224204601890.png)
里面有三个地址
第一个:本地maven目录
第二个:本地maven目录-->conf-->setting.xml 就是maven配置文件
第三个:本地仓库位置 要是再setting.xml中设置了本地仓库位置idea就会根据setting,xml中的设置自动设置
配置完毕
来看看maven项目中pom.xml配置文件中需要注意的地方
项目基础信息
<!-- 域名-->
<groupId>cn.qf.wzh</groupId>
<!-- 项目名-->
<artifactId>mavenDame</artifactId>
<!-- 版本号-->
<version>1.0</version>
<!-- 编译类型-->
<packaging>pom</packaging>
子项目列表
<!-- 子项目-->
<modules>
<module>case01</module>
</modules>
父项目
<!-- 指明父项目-->
<parent>
<groupId>cn.qf.wzh</groupId>
<artifactId>mavenDame</artifactId>
<version>1.0</version>
</parent>
依赖
<dependencies>
<!-- 把阿里云仓库中的依赖粘贴到这里,maven就会自动去阿里云仓库下载到本地仓库供idea和maven使用-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.9.2</version>
</dependency>
</dependencies>