2、安装jdk1.8,安装默认的目录为: /usr/lib/jvm/
yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel
export JAVA_HOME=/usr/lib/jvm/java-1.8.0
export JRE_HOME=$JAVA_HOME/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
https://maven.apache.org/download.cgi
然后把下载好的文件 apache-maven-3.8.6-bin.tar.gz 上传到该目录 /usr/local/maven
tar -zxvf apache-maven-3.8.6-bin.tar.gz -C /usr/local/maven
rm -f apache-maven-3.8.6-bin.tar.gz
export MAVEN_HOME=/usr/local/maven/apache-maven-3.8.6
export PATH=${MAVEN_HOME}/bin:${PATH}
vim /usr/local/maven/apache-maven-3.8.6/conf/settings.xml
找到<mirrors></mirrors>标签对,添加以下代码:
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
vim /usr/local/maven/apache-maven-3.8.6/conf/settings.xml
找到<profiles></profiles>标签对,修改<profile></profile>里面的内容为:
<activeByDefault>true</activeByDefault>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
<localRepository>/usr/local/maven/repository</localRepository>