Maven安装
- 一、Centos7.9安装
- 1.下载
- 2.安装
- 3.设置国内镜像
- 4.设置maven安装路径
一、Centos7.9安装
1.下载
- 第一种:官网下载最新版本:http://maven.apache.org/download.cgi
- 第二种:其他版本下载:https://archive.apache.org/dist/maven/maven-3
- 以下演示使用maven3.6.3版本演示:https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
2.安装
mkdir /usr/local/maven
tar -zxvf apache-maven-3.6.3-bin.tar.gz -C /usr/local/maven/
vi ~/.bashrc
export MAVEN_HOME=/usr/local/maven/apache-maven-3.6.3
export PATH=${MAVEN_HOME}/bin:$PATH
source ~/.bashrc
mvn -version
ln -s /usr/local/maven/apache-maven-3.6.3/bin/mvn /usr/bin/mvn
ln -s /usr/local/maven/apache-maven-3.6.3/bin/mvn /usr/local/bin/mvn
3.设置国内镜像
vi /usr/local/maven/apache-maven-3.6.1/conf/settings.xml
- 安装目录下 找到conf文件下的 settings.xml 然后vim settings.xml 找到mirrors标签对,添加一下代码
<mirror><id>alimaven</id><mirrorOf>central</mirrorOf><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror><mirror><id>alimaven</id><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/groups/public/</url><mirrorOf>central</mirrorOf>
</mirror>
4.设置maven安装路径
mkdir -p /data/mavenfile