CentOS 7安装Maven and Ant

来自linux中国网wiki
跳到导航 跳到搜索

CentOS 7 yum安装Maven、Ant

#wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install apache-maven
yum -y install ant
#Apache Maven 3.5.2 java version: 1.8.0_181
mvn  -V 
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T03:58:13-04:00)
Maven home: /usr/share/apache-maven
Java version: 1.8.0_181, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/jre

cento6 yum maven

sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven

bin包 安装Maven

wget  -c http://www-us.apache.org/dist/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
tar xvf apache-maven-3.5.4-bin.tar.gz && mkdir -p /data/apps/ &&  mv apache-maven-3.5.4/  /data/apps/maven/

添加环境变量
打开 /etc/profile, 添加如下内容:

MAVEN_HOME=/data/apps/maven
export PATH=$PATH:$MAVEN_HOME/bin


验证
mvn -v 
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T14:33:14-04:00)
Maven home: /data/apps/maven
Java version: 1.8.0_121, vendor: Oracle Corporation, runtime: /usr/java/jdk1.8.0_121/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-693.el7.x86_64", arch: "amd64", family: "unix"

【Maven实战】之Linux环境下Nexus3.6安装

【Maven实战】之基础知识点


err

maven 配置(安装)以及遇到的The JAVA_HOME environment variable is not defined correctly. 重新配置 JAVA_HOME

see also

使用nexus搭建maven私服

Linux命令行下安装Maven与配置