一、安装
wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
yum -y install apache-maven
二、查询安装目录
1、查找包路径
rpm -qa|grep apache-maven
2、根据包路径查找安装目录
rpm -ql apache-maven-3.5.2-1.el7.noarch
三、配置
配置环境变量:
# maven
export MAVEN_HOME=/usr/share/apache-maven
export PATH=$MAVEN_HOME/bin:$PATH
<localRepository>/usr/share/apache-maven/repo</localRepository>
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>