Centos7安装apache-maven-3.5.2-bin.tar.gz

时间:2021-07-21 21:08:33

安装maven要有jdk环境

一  上传maven源码包到/usr/local/maven目录下

这个位置在哪都行,按个人喜好了

二  解压安装包

解压到当前目录

tar zxvf apache-maven-3.5.2-bin.tar.gz

解压到其他目录

tar zxvf apache-maven-3.5.2-bin.tar.gz -C /mavenhome

三  配置环境变量

export M3_HOME=/usr/local/maven/apache-maven-3.5.2
export PATH=$PATH:$M3_HOME/bin

使配置生效

source /etc/profile

四  查看是否配置成功

[root@localhost apache-maven-3.5.2]# mvn -version
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T15:58:13+08:00)
Maven home: /usr/local/maven/apache-maven-3.5.2
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /usr/local/jdk/jdk1.8.0_151/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-693.el7.x86_64", arch: "amd64", family: "unix"