ubuntu16.04安装maven

前端之家收集整理的这篇文章主要介绍了ubuntu16.04安装maven前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

注意:安装maven前需要安装java并配置好环境变量,具体安装过程参见:ubuntu16.04安装Oracle JDK

创建文件

sudo mkdir -p /usr/local/maven

切换文件
cd /usr/local/maven/

下载解压
wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz
tar -zxvf apache-maven-3.5.0-bin.tar.gz

配置环境变量

编辑~/.bashrc

sudo gedit ~/.bashrc

在最后添加
# set maven environment
export M2_HOME=/usr/local/maven/apache-maven-3.5.0
export PATH=$M2_HOME/bin:$PATH

使环境变量生效
source ~/.bashrc
测试maven命令
virtual-machine:~$ mvn --version
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: 9.0.1,vendor: Oracle Corporation
Java home: /usr/local/jvm/jdk-9.0.1
Default locale: zh_CN,platform encoding: UTF-8
OS name: "linux",version: "4.10.0-37-generic",arch: "amd64",family: "unix"
原文链接:https://www.f2er.com/ubuntu/350822.html

猜你在找的Ubuntu相关文章