如何使用上aliyun的maven镜像

来源:互联网 发布:java获取当前时间 编辑:程序博客网 时间:2024/05/17 01:54

众所周知,在国内使用maven,下载速度实在无法忍受,严重影响开发效率。后来oschina架了个镜像,但是现在也用不了,关闭了。
好在现在aliyun也架了一个,可以使用,而且速度相当赞。


在.m2/目录下新建一个settings.xml文件,内容如下:

<?xml version="1.0" encoding="UTF-8"?><settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">  <proxies/>  <mirrors>    <mirror>      <id>alimaven</id>      <name>aliyun maven</name>      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>      <mirrorOf>central</mirrorOf>    </mirror>  </mirrors>  <profiles/></settings>

或者如果原来已经存在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>
1 1