【0】下载maven
https://maven.apache.org/download.cgi
wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
注意下载 apache-maven-3.8.6-bin.tar.gz格式的版本,适用linux
【1】解压安装
tar -zxvf apache-maven-3.8.6-bin.tar.gz
mv apache-maven-3.8.6-bin maven3
mv maven3 /usr/local/
并修改环境变量配置
export MAVEN_HOME=/usr/local/maven3
export PATH=${PATH}:${MAVEN_HOME}/bin
source /etc/profile
【2】修改maven源为阿里云
vim /usr/local/maven3/conf/settings.xml
找到mirrors标签,配置阿里云公共仓库
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>