下载安装
-
直接解压
liuzd@liuzhendongdeMacBook-Pro ~ % cd Develop/Tools liuzd@liuzhendongdeMacBook-Pro Tools % tar -zxvf apache-maven-3.8.1-src.tar.gz
-
打开配置
# 找到配置文件并使用指定app打开 liuzd@liuzhendongdeMacBook-Pro Tools % mv apache-maven-3.8.1 ../Maven liuzd@liuzhendongdeMacBook-Pro Tools % cd ../Maven/apache-maven-3.8.1/conf liuzd@liuzhendongdeMacBook-Pro conf % open -a /Applications/Visual\ Studio\ Code.app settings.xml
-
编辑配置
# 仓库地址 <localRepository>/Users/liuzd/.m2/repository</localRepository> # 私服配置(可以有很多) <mirror> <id>aliyun</id> <name>aliyun</name> <mirrorOf>central</mirrorOf> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> </mirror>
-
环境变量配置
# 打开配置文件 liuzd@liuzhendongdeMacBook-Pro ~ % open ~/.bash_profile # Maven export MAVEN_HOME=/Users/liuzd/Develop/Maven/apache-maven-3.8.1 export PATH=$MAVEN_HOME/bin:$PATH
-
配置生效
# 环境配置文件 liuzd@liuzhendongdeMacBook-Pro ~ % source .bash_profile # 全局控制文件 liuzd@liuzhendongdeMacBook-Pro ~ % source ~/.zshrc
-
查看
liuzd@liuzhendongdeMacBook-Pro ~ % mvn -version Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: /Users/liuzd/Develop/Maven/apache-maven-3.8.1 Java version: 1.8.0_333, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_333.jdk/Contents/Home/jre Default locale: zh_CN, platform encoding: UTF-8 OS name: "mac os x", version: "14.1.1", arch: "x86_64", family: "mac" liuzd@liuzhendongdeMacBook-Pro ~ %