- 官网下载maven安装包并解压
https://www.apache.org/
- 修改conf/settings.xml切换mirror源
<!-- 切换mirror源 -->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
- 修改conf/settings.xml添加profile
<!-- 添加profile -->
<profile>
<id>jdk-1.8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<repositories>
<repository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
- 配置系统环境变量
// 添加MAVEN_HOME
MAVEN_HOME=D:\softwares\develop\apache-maven-3.8.1
// 添加path路径
%MAVEN_HOME%\bin
- 命令行查看安装结果
mvn -version
- 修改idea配置
Settings-Build, Execution, Deployment-Build Tools-Maven