maven 换阿里镜像

张映 发表于 2018-12-18

分类目录: java/android

标签:, ,

maven的默认镜像,有的时候,下载jar包的非常的慢。换了阿里镜像速度快了很多。

1,查找maven的配置文件

MacBook-Pro:conf zhangying$ mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home: /usr/local/Cellar/maven/3.5.0/libexec  //maven home路径
Java version: 1.8.0_112, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"

mac,centos都可以通过查看版本的方式来查找路径,其他linux应当一样。

2,配置settings.xml

$ cd /usr/local/Cellar/maven/3.5.0/libexec/conf
$ cp settings.xml settings.xml_bak
$ vim setting.xml //将mirrors改成如下内容
<mirrors>
 <mirror>
 <id>aliyun</id>
 <mirrorOf>central</mirrorOf>
 <name>aliyun</name>
 <url>http://maven.aliyun.com/nexus/content/groups/public</url>
 </mirror>
 <mirror>
 <id>UK</id>
 <name>UK Central</name>
 <url>http://uk.maven.org/maven2</url>
 <mirrorOf>central</mirrorOf>
 </mirror>
</mirrors>


转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/android/2002.html

留下评论

留下评论
  • (必需)
  • (必需) (will not be published)
  • (必需)   1X5=?