配置.bash_profile
vim ~/.bash_profilec
# 写入maven路径
export M2_HOME=/Users/heroma/java/apache-maven-3.6.3
export PATH=$PATH:$M2_HOME/bin
# 使配置生效
source .bash_profile
# 验证
mvn -v
配置.zshrc
vim ~/.zshrc
# 写入maven路径
export M2_HOME=/Users/heroma/java/apache-maven-3.6.3
export PATH=$PATH:$M2_HOME/bin
// 使配置生效
source ~/.zshrc
# 验证
mvn -v
使用阿里镜像
-
打开apache-maven-3.6.3–>cof–>settings.xml
-
接着对settings.xml备份
-
添加阿里源,添加下面的代码
<mirrors> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors>
-
修改本地仓库位置,添加下面的代码
<localRepository>/Users/heroma/java/local/repo</localRepository>