Maven是当前流行的项目管理工具,但官方的库在国外经常连不上,连上也下载速度很慢。国内oschina的maven服务器很早之前就关了。今天发现阿里云的一个中央仓库,亲测可用。
11 <mirror> 22 <id>alimaven</id> 33 <mirrorOf>central</mirrorOf> 44 <name>aliyun maven</name> 55 <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> 66 </mirror>
修改${maven.home}/conf或者${user.home}/.m2文件夹下的settings.xml文件,在<mirrors>标签下加入上述内容即可。如下:
1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 3 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 4 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> 5 5 <mirrors> 6 6 <!-- 阿里云仓库 --> 7 7 <mirror> 8 8 <id>alimaven</id> 9 9 <mirrorOf>central</mirrorOf> 1010 <name>aliyun maven</name> 1111 <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> 1212 </mirror> 1313 1414 <!-- 中央仓库1 --> 1515 <mirror> 1616 <id>repo1</id> 1717 <mirrorOf>central</mirrorOf> 1818 <name>Human Readable Name for this Mirror.</name> 1919 <url>http://repo1.maven.org/maven2/</url> 2020 </mirror> 2121 2222 <!-- 中央仓库2 --> 2323 <mirror> 2424 <id>repo2</id> 2525 <mirrorOf>central</mirrorOf> 2626 <name>Human Readable Name for this Mirror.</name> 2727 <url>http://repo2.maven.org/maven2/</url> 2828 </mirror> 2929 </mirrors> 3030 </settings>