1.在/etc/profile下添加环境变量
export M2_HOME=/home/nick/javaEnv/apache-maven-3.5.4
PATH=$M2_HOME/bin:$PATH
2.更新配置文件
source /etc/profile
3.mvn -v 确认安装
4.修改本地仓库,在maven/conf/settings.xml文件中
<localRepository>/home/nick/javaEnv/apache-maven-3.5.4/nickRepository</localRepository>
5.添加阿里云源
同样在settings.xml中添加
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>;
<mirrorOf>central</mirrorOf>
</mirror>