Linux(centos7)安裝maven3.5

Linux(centos7)安裝maven3.5

 

http://mirrors.shuosc.org/apache/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.tar.gz

1.建立一個maven文件夾

[root@MiWiFi-R3-srv ~]# mkdir /usr/local/maven
  • 1

2.上傳apache-maven-3.5.0-bin.tar.gz到/usr/local/maven/目錄下

連接: https://pan.baidu.com/s/1c6QDXW 密碼: ymq2html

3.解壓

[root@MiWiFi-R3-srv ~]# tar -zxvf apache-maven-3.5.0-bin.tar.gz -C /usr/local/maven/
  • 1

4.設置環境變量

[root@MiWiFi-R3-srv ~]# vim /etc/profile
  • 1

在/etc/profile的文件末尾添加如下配置:java

export M2_HOME=/usr/local/maven/apache-maven-3.3.9
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$M2_HOME/bin:$PATH
  • 1
  • 2

執行source命令讓新配置當即生效:linux

[root@MiWiFi-R3-srv ~]# source /etc/profile
  • 1

5.測試

[root@MiWiFi-R3-srv ~]# mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home: /usr/local/maven/apache-maven-3.5.0
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /usr/local/java/jdk1.8.0_144/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-327.el7.x86_64", arch: "amd64", family: "unix"
相關文章
相關標籤/搜索