Mac OSX Maven设置
2018-01-13 本文已影响0人
大辉2012
1.下载Maven,解压缩
macdeMacBook-Pro:apache-maven-3.5.2 mac$ pwd
/Users/mac/dev/apache-maven-3.5.2
2.设置环境变量
- 编辑文件
vi ~/.bash_profile
- 修改内容
M3_HOME=/Users/mac/dev/apache-maven-3.5.2
PATH=$M3_HOME/bin:$PATH
export M3_HOME
export PATH
- 立即生效
source ~/.bash_profile
- 验证结果
macdeMacBook-Pro:apache-maven-3.5.2 mac$ mvn -v
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T00:58:13-07:00)
Maven home: /Users/mac/dev/apache-maven-3.5.2
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.5", arch: "x86_64", family: "mac"
3.设置本地仓库
- 编辑文件
/Users/mac/dev/apache-maven-3.5.2/conf/settings.xml
- 编辑内容
<settings>
<localRepository>/Users/mac/dev/mavenlib</localRepository>
</settings>
4.设置国内镜像库
- 编辑文件
/Users/mac/dev/apache-maven-3.5.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>
Maven查找顺序,先找本地 再找国内镜像 再找中央仓库 把快的放在前面。