CentOS7安装Maven
wanyakun 6/24/2021
Maven官方下载地址为:Maven下载 (opens new window)
查看最新版本为3.8.1,
# 下载
下载安装包,选择tar.gz压缩包:
wget https://mirrors.bfsu.edu.cn/apache/maven/maven-3/3.8.1/binaries/apache-maven-3.8.1-bin.tar.gz
1
# 解压
## 解压
tar vxf apache-maven-3.8.1-bin.tar.gz
## 移动
sudo mv apache-maven-3.8.1 /usr/local/maven3
1
2
3
4
5
2
3
4
5
# 修改环境变量
sudo vim /etc/profile
1
添加以下内容
MAVEN_HOME=/usr/local/maven3
export MAVEN_HOME
export PATH=${PATH}:${MAVEN_HOME}/bin
1
2
3
2
3
执行source使环境生效
source /etc/profile
1
# 验证
mvn -v
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /usr/local/maven3
Java version: 1.8.0_291, vendor: Oracle Corporation, runtime: /usr/local/java/jdk1.8.0_291/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-1127.el7.x86_64", arch: "amd64", family: "unix"
1
2
3
4
5
6
2
3
4
5
6