Article Directory
1. maven download
Since maven does not support direct installation with yum, this method is used to install
Click the link to download apache-maven-3.6.3-bin.tar.gz
wget https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
1.1 Move the compressed package location
It is recommended to put the compressed package under usr/local
Command:
mv apache-maven-3.6.3-bin.tar.gz /usr/local
1.2 Decompression
tar -zxvf apache-maven-3.6.3-bin.tar.gz
1.3 Rename
2. Maven configuration modification
2.1 Create warehouse
mkdir /usr/local/maven/repository
2.2 Edit settings.xml file
Add the following content to the settings.xml file:
#添加本地仓库地址
<localRepository>/usr/local/maven/repository/</localRepository>
#添加阿里云仓库
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
2.3 Add environment variables
vim /etc/profile
export MAVEN_HOME=/usr/local/maven
export PATH=$MAVEN_HOME/bin:$PATH
#生效环境变量
source /etc/profile
# 查看maven版本,检查环境变量是否配置成功
mvn -v
So far, the installation of Maven has been completed.