安装Maven
当前系统
[root@141 ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
下载 http://maven.apache.org/download.cgi
wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.tar.gz
安装
mkdir -p /opt/maven
tar -xzvf apache-maven-3.5.3-bin.tar.gz -C /opt/maven/
ln -s /opt/maven/apache-maven-3.5.3 /usr/local/maven
echo 'export M2_HOME=/usr/local/maven' >> /etc/profile
echo 'export PATH=$M2_HOME/bin:$PATH' >> /etc/profile
source /etc/profile
mvn -v
配置Maven:使用国内镜像
使用阿里镜像,在用户配置文件.m2/settings.xml
中配置:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>CN</id>
<name>aliiyun Central</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>