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查找顺序,先找本地 再找国内镜像 再找中央仓库 把快的放在前面。

上一篇 下一篇

猜你喜欢

热点阅读