eclipse中使用maven插件 index不能更新

问题产生如下:
因为单位使用了过滤,访问Internet时,超过10M的内容就拒绝。
因为maven 插件在初始时,需要下载Maven的index文件,这个文件比较大,有38M多,下载不成功。
所以造成使用Maven添加依赖项时(Add Dependency)时,没有提示项目可用,并且在Console中,输出:
Unable to update index for central|http://repo1.maven.org/maven2 。 解决方式如下: 1、通过其它方式下载如下两个文件:
http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.properties
http://repo2.maven.org.s3.amazonaws.com/.index/nexus-maven-repository-index.gz 2、找一个Apache服务器,在其根据目录下建立一个 .index 的目录,把上述两个文件拷贝至该目录下。 3、编辑 c:\WINDOWS\system32\drivers\etc\hosts 文件,在文件中加入:
10.15.2.52    repo2.maven.org.s3.amazonaws.com
注:10.15.2.52 为步骤2的Apache服务器IP地址。 4、在Eclipse中,打开 Maven Repositories 面板,
在 Global Repositories --> central 项上,点右键,Rebuild Index 即可。 5、移除之前在 hosts 文件中添加的内容。 6、(可选)把Properties中Maven项的 Download repository index updates on starup 选项去除。

猜你喜欢

转载自caizh2009.iteye.com/blog/1147092