Download the bin file on the Apache website and extract it to the appropriate directory. Then configure/etc/profile, environment variable named M2_home, as follows: (note source/etc/profile after configuration)
#Maven
Export m2_home=/usr/local/apache-maven-3.3.1
Export path= $PATH: $M 2_home/bin
Because there are a lot of things to download at compile time, we can edit the Maven\conf\settings.xml file and change the mirror site to the Chinese open source image point as follows:
<mirrors>
<mirror>
<id>nexus-osc</id>
<mirrorOf>*</mirrorOf>
<name>Nexusosc</name>
<url>http://maven.oschina.net/content/groups/public/</url>
</mirror>
</mirrors>
and (be careful not to change this file to the wrong one)
<profiles>
<profile>
<id>jdk-1.7</id>
<activation>
<jdk>1.7</jdk>
</activation>
<repositories>
<repository>
<id>nexus</id>
<name>local Private nexus</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>local Private nexus</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
This maven\conf\settings.xml file is then copied to the ~/.m2 folder to ensure that the user can use this configuration (. M2 is a hidden folder) every time maven is used.
Maven changes mirror site to China Open Source mirror Point