Maven安装及配置(Linux系统)
环境说明:Linux环境,CentOS 7版本。
第一步:下载Maven,地址:http://maven.apache.org/download.cgi
我这里下载的是【apache-maven-3.6.1-bin.zip】,解压后如下:
[root@localhost maven]# unzip apache-maven-3.6.1-bin.zip [root@localhost apache-maven-3.6.1]# ls bin boot conf lib LICENSE NOTICE README.txt
第二步:配置环境变量
1、切换到root账户 2、vi /etc/profile ,进入文件后,在最后面追加两条路径,如下:
export MAVEN_HOME=/root/apps/maven/apache-maven-3.6.1
export PATH=$PATH:$MAVEN_HOME/bin
3、source /etc/profile ,文件生效!
4、验证结果:
[root@localhost /]# mvn -v Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T03:00:29+08:00) Maven home: /root/apps/maven/apache-maven-3.6.1 Java version: 1.8.0_131, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64/jre Default locale: zh_CN, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-693.el7.x86_64", arch: "amd64", family: "unix"