Try to install in centos below maven, execute the following command:
yum install stomach
Then passing install a lot of things, obviously there is no need (ubuntu should have a similar situation)
Decided to install it manually.
Installation process
1. Download the file maven
curl -X GET http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -o apache-maven-3.6.3-bin.tar.gz tar -zxvf apache-maven-3.6.3-bin.tar.gz mv apache-maven-3.6.3 /opt/
2, edit the profile file
Vim / etc / Profile # Shift + G tail was added was adjusted to the following settings Export the JAVA_HOME = / Script / jdk1. . 8 .0_65 Export MAVEN_HOME = / opt / Apache-maven- 3.6 . . 3 Export the CLASSPATH = $ the JAVA_HOME / lib Export the PATH = $ PATH: $ MAVEN_HOME / bin: $ JAVA_HOME / bin
3, to validate the configuration
source /etc/profile
If the current user is disposed in the home environment variable, put the / etc / profile into ~ / .bash_profile
Confirm successful installation command:
mvn -v
4, arranged mirroring
New storage jar directory
mkdir repo
1, set the repository directory
vim conf/settings.xml
Add to
<localRepository>/opt/apache-maven-3.6.3/repo</localRepository>
2, the mirror is provided
Add the following node in the node mirrors
<mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url></mirror>
转载自:https://www.cnblogs.com/youxiu326/p/10540752.html