1 2 |
grep -nr https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip vim .mvn/wrapper/maven-wrapper.properties |
1 2 |
cd /home wget https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz --no-check-certificate |
1
|
tar -zxvf apache-maven-3.6.3-bin.tar.gz |
1
|
mv apache-maven-3.6.3 /opt/ |
1
|
vim /etc/profile
|
1 2 |
export MAVEN_HOME=/opt/apache-maven-3.6.3 export PATH=$MAVEN_HOME/bin:$PATH |
1
|
source /etc/profile |
1 2 |
echo $MAVEN_HOME echo $PATH |
1
|
mvn -v
|
1
|
vim /opt/apache-maven-3.6.3/conf/settings.xml
|
未配置时,默认地址是${user.home}/.m2/repository,以root用户登录,则本地仓路径为“/root/.m2/repository”。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<mirrors> <mirror> <id>huaweicloud</id> <mirrorOf>*</mirrorOf> <url>https://mirrors.huaweicloud.com/repository/maven/</url> </mirror> </mirrors> <profiles> <profile> <id>repoId1</id> <activation> <activeByDefault>true</activeByDefault> </activation> <repositories> <repository> <id>huaweimaven</id> <name>huaweimaven</name> <url>https://mirrors.huaweicloud.com/kunpeng/maven</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> </profile> </profiles> |
对于通过代理访问外网的情况,需要配置网络代理(host、port、username、password根据实际环境修改)。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<proxies> <proxy> <id>my-proxy</id> <active>true</active> <protocol>https</protocol> <host>xxx</host> <port>xxx</port> <username>xxx</username> <password>xxx</password> <nonProxyHosts>local.net|some.host.com</nonProxyHosts> </proxy> <proxy> <id>my-proxy1</id> <active>true</active> <protocol>http</protocol> <host>xxx</host> <port>xxx</port> <username>xxx</username> <password>xxx</password> <nonProxyHosts>local.net|some.host.com</nonProxyHosts> </proxy> </proxies> |