0
点赞
收藏
分享

微信扫一扫

配置maven环境并切换镜像源


  1. 官网下载maven安装包并解压

https://www.apache.org/

  1. 修改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>

  1. 修改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>

  1. 配置系统环境变量

// 添加MAVEN_HOME
MAVEN_HOME=D:\softwares\develop\apache-maven-3.8.1
// 添加path路径
%MAVEN_HOME%\bin

  1. 命令行查看安装结果

mvn -version

  1. 修改idea配置

Settings-Build, Execution, Deployment-Build Tools-Maven


举报

相关推荐

0 条评论