1.下载
https://archive.apache.org/dist/maven/maven-3/
2.解压到/Users/zhanglei/maven下
3.配置
3.1修改conf下的settings.xml
配置阿里云镜像
<mirror>
<id>alimanven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
配置本地仓库
<localRepository>/Users/zhanglei/maven/maven-repository</localRepository>
3.2编辑bash_profile文件
$ open .bash_profile
3.3写入
#Setting PATH for Maven
export MAVEN_HOME=/Users/zhanglei/maven/apache-maven-3.5.0
export PATH=$PATH:$MAVEN_HOME/bin
3.4生效
$ source .bash_profile 使文件生效
$ mvn -v