Linux安装Maven

1. 创建目录

> mkdir /opt/maven

> cd /opt/maven

 

2. 下载maven

> wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.tar.gz

 

3. 解压压缩包

> tar -zxvf apache-maven-3.5.3-bin.tar.gz

> ln -s apache-maven-3.5.3 apache-maven

 

4. 配置环境变量

> vi /etc/profile

输入下面内容

export M2_HOME=/opt/maven/apache-maven
export PATH=$PATH:$M2_HOME/bin

> source /etc/profile

 

5. 检查是否安装成功

> mvn -v

成功显示下面的内容

Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-25T03:49:05+08:00)
Maven home: /opt/maven/apache-maven
Java version: 1.8.0_162, vendor: Oracle Corporation
Java home: /opt/java/jdk1.8.0_162/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-693.el7.x86_64", arch: "amd64", family: "unix"

posted @ 2018-06-12 20:42  aston  阅读(116)  评论(0编辑  收藏  举报