Maven 项目使用开源中国镜像

从maven中央库下载jar非常缓慢甚至有时候会下载不下来。

可以采用中国的maven镜像。目前主要是 开源中国的镜像。

  1. 找到maven配置文件setting.xml,打开

  2. 中间添加开源中国的配置:

<!-- 开源中国 -->
<mirror>  
        <id>CN</id>  
        <name>OSChina Central</name>                                                                                                                         
        <url>http://maven.oschina.net/content/groups/public/</url>  
        <mirrorOf>central</mirrorOf>  
      </mirror> 
 <mirror>  
        <id>repo2</id>  
        <mirrorOf>central</mirrorOf>  
        <name>Human Readable Name for this Mirror.</name>  
        <url>http://repo2.maven.org/maven2/</url>  
      </mirror>  
  
 <mirror>
		<id>osc_thirdparty</id>
		<mirrorOf>thirdparty</mirrorOf>
		<url>http://maven.oschina.net/content/repositories/thirdparty/
		</url>
</mirror>
  
 <!-- 国外 -->
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>

<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror> 

修改完成后保存
3. 重启eclipse,即可开源中国或者其他仓库去下载jar包

posted @ 2016-05-23 01:11  wwyz  阅读(2321)  评论(0编辑  收藏  举报