maven 国内镜像源配置

in with 0 comment

不知道从什么时候开始,maven中央仓库的数据下载就全靠运气了。 所以我们还是配置一个国内的镜像比较方便。

以阿里的镜像源为例子,添加下面的内容到 settings.xml 的 mirrors 标签内。

<mirror>
	<!--This sends everything else to /public -->
	<id>nexus-aliyun</id>
	<mirrorOf>*</mirrorOf>
	<name>Nexus aliyun</name>
	<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

另外,在项目的pom文件中声明如下,也可以,但是如果在settings.xml有其他的镜像源或者没有配置任务镜像源的情况下,还是会访问到其他镜像源的。

<repositories>
	<repository>
		<id>aliyun</id>
		<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
	</repository>
</repositories>
<pluginRepositories>
	<pluginRepository>
		<id>aliyun</id>
		<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
	</pluginRepository>
</pluginRepositories>

其他镜像源

http://maven.wso2.org/nexus/content/groups/public/
http://jcenter.bintray.com/
http://maven.antelink.com/content/repositories/central/
http://maven.springframework.org/release/
http://maven.antelink.com/content/repositories/central/
http://mavensync.zkoss.org/maven2/
http://repository.jboss.com/maven2/
http://maven.aliyun.com/nexus/content/groups/public
http://uk.maven.org/maven2/
http://repo1.maven.org/maven2/
http://maven.springframework.org/milestone
http://maven.jeecg.org/nexus/content/repositories/
https://repository.apache.org/content/groups/public/
https://repository.jboss.org/nexus/content/repositories/releases/    
http://repo.maven.apache.org/maven2
https://oss.sonatype.org/content/repositories
http://repo.spring.io/release/
http://repo.spring.io/snapshot/