联通网络环境上无法访问http://repo1.maven.org/maven2/中央库解决,镜像库添加

联通网络环境下无法访问http://repo1.maven.org/maven2/中央库解决,镜像库添加
Maven 2的安装和使用虽然不是一点即用,但也不是很复杂。然而,这两天我新装Maven,刚刚过了mvn -version,尝试create maven project就出问题了。问题详情如下。发现联通宽带屏蔽了中央库http://repo1.maven.org/maven2/ 域名IP地址,搞不懂是怎么想的...电信可以正常访问。
D:\mavenSample>mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[INFO] org.codehaus.mojo: checking for updates from central
[INFO] artifact org.apache.maven.plugins:maven-archetype-plugin: checking for updates from central
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Wed Mar 19 14:26:49 CST 2008
[INFO] Final Memory: 1M/2M
[INFO] ------------------------------------------------------------------------
开始以为是internet 代理设置有问题。网上也有帖子这么说。可是换到ADSL后,不用代理了,问题仍然存在。
几经周折后发现,原因在于自己的联通网络环境下无法访问中央库,在网上找了几个镜像,其中有的镜像没有同步更新maven库。经过测试,如下maven 镜像工作正常:


ibiblio.org
ibiblio Mirror of http://repo1.maven.org/maven2/
http://mirrors.ibiblio.org/pub/mirrors/maven2
central



cica.es
http://ftp.cica.es/mirrors/maven2
central




skynet.be
http://maven2.mirrors.skynet.be/pub/maven2
central




在setting.xml中添加上面的镜像服务器

你可能感兴趣的:(maven)