mvn 下载地址:https://maven.apache.org/download.cgi
选择一个合适的版本
cd /opt && curl -o apache-maven-3.8.6-bin.tar.gz https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
tar -xzf apache-maven-3.8.6-bin.tar.gz
sudo echo 'export PATH=\$PATH:/opt/apache-maven-3.8.6/bin:$PATH' >> /etc/profile
suco source /etc/profile
配置镜像仓库:
cd /opt/apache-maven-3.8.6/conf
vi settings.xml
找到 mirrors 的标签,注意不要添加到注释里面,多个镜像,mvn 只会选择使用 第一个
<mirror><id>repo1.maven.org</id><name>repo1 maven</name><url>https://repo1.maven.org/maven2/</url><mirrorOf>central</mirrorOf></mirror><mirror><id>dist.wso2.org</id><url>https://dist.wso2.org/maven2/</url><name>repo apache</name><mirrorOf>dist</mirrorOf></mirror><mirror><id>repo.maven.apache.org</id><url>https://repo.maven.apache.org/maven2/</url><name>repo apache</name><mirrorOf>repo</mirrorOf></mirror>