当前位置: 代码迷 >> 互联网 >> 解决联通网络环境上无法访问Maven中央仓库有关问题
  详细解决方案

解决联通网络环境上无法访问Maven中央仓库有关问题

热度:2970   发布时间:2013-02-26 00:00:00.0
解决联通网络环境下无法访问Maven中央仓库问题

解决无法访问Maven中央仓库:http://repo1.maven.org/maven2/org/apache/问题办法:

当前,中国联通宽带屏蔽了Maven中央库http://repo1.maven.org/maven2/域名IP地址,但
电信可以正常访问,从美国服务器测试可以.解决办法在Maven的配置文件里加Mirror:

<mirrors>
??? <!-- mirror
???? | Specifies a repository mirror site to use instead of a given repository. The repository that
???? | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
???? | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
???? |
??? <mirror>
????? <id>mirrorId</id>
????? <mirrorOf>repositoryId</mirrorOf>
????? <name>Human Readable Name for this Mirror.</name>
????? <url>http://my.repository.com/repo/path</url>
??? </mirror>
???? -->
??? <mirror>
????? <id>ibiblio.org</id>
????? <name>ibiblio Mirror of http://repo1.maven.org/maven2/</name>
????? <url>http://mirrors.ibiblio.org/maven2/</url>
????? <mirrorOf>central</mirrorOf>
????? <!-- United States, North Carolina -->
??? </mirror>
??? <mirror>
????? <id>cica.es</id>
????? <url>http://ftp.cica.es/mirrors/maven2</url>
????? <mirrorOf>central</mirrorOf>
????? <!-- Spain, Sevilla -->
??? </mirror>
</mirrors>

  相关解决方案