这里查找最新版本 http://maven.apache.org/download.cgi
下载安装包
wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz解压
tar -zxvf apache-maven-3.6.3-bin.tar.gz配置maven环境
vi /etc/profile # maven export MAVEN_HOME=上一步解压的目录 export PATH=$MAVEN_HOME/bin:$PATH
重新加载配置文件
source /etc/profile
修改MAVEN配置文件MAVEN_HOME/conf/settings.xml:1.设置本地仓库地址 2.引用国内镜像以及个人私服 3.指定JDK
<?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"> <pluginGroups> </pluginGroups> <!-- 配置jar包下载路径 linux需要更改为/目录开头的linux目录 --> <localRepository>本地仓库目录</localRepository> <proxies> </proxies> <servers> </servers> <!-- 从阿里云镜像下载jar包 --> <mirrors> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors> <!-- 指定jdk1.8 --> <profiles> <profile> <id>jdk1.8</id> <activation> <activeByDefault>true</activeByDefault> <jdk>1.8</jdk> </activation> <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> </profile> </profiles> </settings>