1.maven的下载
2.配置环境变量
(略)
3.检查配置是否成功
cmd窗口输入 mvn -version,显示版本号,表示配置成功
4.找到Maven安装包中的setting.xml文件,路径conf/settings.xml
(1)本地仓库位置修改,在 localRepository 标签内添加自己的本地位置路径
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<localRepository>D:\download\2020\maven\.m2\repository</localRepository>
(2) 修改maven默认的JDK版本,在profiles标签下添加一个 profile 标签,修改maven默认的JDK版本
<profile>
<id>JDK-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
(3)添加国内镜像源,添加mirrors标签下 mirror ,一般使用阿里云镜像库
<!-- 阿里云仓库 -->
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<!-- 中央仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
<!-- 中央仓库2 -->
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
5.maven在idea中的设置
6.重新导包即可