红联Linux门户
Linux帮助

Ubuntu 16.04安装Maven3.3.9

发布时间:2016-05-28 15:34:45来源:linux网站作者:ccskun

1、下载地址

http://maven.apache.org/download.cgi

Ubuntu 16.04安装Maven3.3.9


2、将下载到的apache-maven-3.3.9-bin.tar.gz(http://mirror.bit.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz)文件上传到/temp目录下,然后切换到root用户下,执行如下命令。

root@test:/temp# tar zxvf apache-maven-3.3.9-bin.tar.gz
root@test:/temp# cd /opt
root@test:/opt# mv /temp/apache-maven-3.3.9 .


3、创建软链接

root@test:/bin# ln -s /opt/apache-maven-3.3.9/bin/mvn mvn


4、添加环境配置

root@test:/opt/jdk1.8.0_92# gedit /etc/profile
......
export M2_HOME=/opt/apache-maven-3.3.9
export PATH=${M2_HOME}/bin:$PATH
......

执行下面命令使配置文件生效

root@test:/opt/jdk1.8.0_92# source /etc/profile


5、使用其它用户验证

ccskun@test:~$ mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /opt/apache-maven-3.3.9
Java version: 1.8.0_92, vendor: Oracle Corporation
Java home: /opt/jdk1.8.0_92/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-22-generic", arch: "amd64", family: "unix"
ccskun@test:~$


本文永久更新地址:http://www.linuxdiyf.com/linux/21032.html