Linux中安装Maven & Ant

2018-04-22 05:43

Linux中安装Maven


下载Maven安装包

Maven apache官方下载http://maven.apache.org/bindownload.cgi

阿里云镜像

下载:apache-maven-x.x.x-bin.tar.gz 到Linux 常用文件保存目录,如/home/soft

1
[root@test soft]# tar zxvf apache-maven-x.x.x-bin.tar.gz -C /home/modules

tar zxvf xxx -C xxxx 压缩包解压到 xxx 目录

配置环境变量

[root@test modules]# vi /etc/profile

1
MAVEN_HOME=/home/modules/apache-maven-3.5.3
2
export MAVEN_HOME
3
export PATH=${PATH}:${MAVEN_HOME}/bin

刷新配置文件

1
[root@test modules]# source /etc/profile

验证

1
[root@test modules]# mvn -v
2
3
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-25T03:49:05+08:00)
4
Maven home: /home/modules/apache-maven-3.5.3
5
Java version: 1.8.0_151, vendor: Oracle Corporation
6
Java home: /home/modules/jdk1.8.0_151/jre
7
Default locale: zh_CN, platform encoding: UTF-8
8
OS name: "linux", version: "3.10.0-693.2.2.el7.x86_64", arch: "amd64", family: "unix"

Linux中安装Ant


下载Ant安装包

Ant apache官方下载http://ant.apache.org/bindownload.cgi

阿里云镜像

下载:apache-ant-x.x.x-bin.tar.gz 到Linux 常用文件保存目录,如/home/soft

1
[root@test soft]# tar zxvf apache-ant-x.x.x-bin.tar.gz -C /home/modules

tar zxvf xxx -C xxxx 压缩包解压到 xxx 目录

配置环境变量

[root@test modules]# vi /etc/profile

1
export ANT_HOME=/home/modules/apache-ant-1.9.11
2
export PATH=$PATH:$ANT_HOME/bin

刷新配置文件

1
[root@test modules]# source /etc/profile

验证

1
[root@test modules]# ant -version
2
Apache Ant(TM) version 1.9.11 compiled on March 23 2018

[root@a0 modules]# ant -version
Apache Ant(TM) version 1.9.11 compiled on March 23 2018

至此,Linux中Maven,Ant成功安装


标签: Linux

License(CC)BY-NC-SA © 2017 — 2019 hadronw | Theme based on fzheng.me