如何使用上aliyun的maven镜像

众所周知,在国内使用maven,下载速度实在没法忍受,严重影响开发效率。后来oschina架了个镜像,可是如今也用不了,关闭了。
好在如今aliyun也架了一个,能够使用,并且速度至关赞。web


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

<?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中间加入以下配置便可:maven

<mirror>
  <id>alimaven</id>
  <name>aliyun maven</name>
  <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
  <mirrorOf>central</mirrorOf>
</mirror>