1、官方下载地址:
https://maven.apache.org/download.cgi
2、配置
[root@localhost apache-maven-3.6.3]# export MAVEN_HOME=/opt/maven/apache-maven-3.6.3 [root@localhost apache-maven-3.6.3]# export PATH=${PATH}:${MAVEN_HOME}/bin [root@localhost apache-maven-3.6.3]# source /etc/profile [root@localhost apache-maven-3.6.3]# mvn -v Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: /opt/maven/apache-maven-3.6.3 Java version: 1.8.0_281, vendor: Oracle Corporation, runtime: /opt/java/jdk1.8.0_281/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.18.0-147.el8.x86_64", arch: "amd64", family: "unix"
环境变量
1、编辑系统配置文件
[root@localhost opt]# vim /etc/profile
2、添加内容并保存
# maven export MAVEN_HOME=/opt/maven/apache-maven-3.6.3 export PATH=${PATH}:${MAVEN_HOME}/bin
3、立即生效
[root@localhost opt]# source /etc/profile