echo "安装Java环境,先安装JDK"
yum -y install java-openjdk
echo "切换到/usr/local/src下载目录"
cd /usr/local/src/
echo "下载软件"
yum -y install wget
wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.tar.gz
echo "解压缩到指定目录"
tar -zxv -f apache-maven-3.6.2-bin.tar.gz -C /usr/local/
echo "设置环境变量"
cat /etc/profile.d/maven.sh
#!/bin/bash
export MAVEN_HOME=/usr/local/apache-maven-3.6.2
export PATH=${MAVEN_HOME}/bin:${PATH}
source /etc/profile.d/maven.sh
echo "验证"
echo ${MAVEN_HOME}
mvn -version
echo "设置Maven仓库地址为阿里云仓库"
echo "需要手动操作"
#vim /usr/local/apache-maven-3.6.2/conf/settings.xml
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>