首页 / ECLIPSE / (转载)解决eclipse安装maven的问题:Unable to update index for central|http://repo1.maven.org/maven2
(转载)解决eclipse安装maven的问题:Unable to update index for central|http://repo1.maven.org/maven2
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了(转载)解决eclipse安装maven的问题:Unable to update index for central|http://repo1.maven.org/maven2,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2291字,纯文字阅读大概需要4分钟。
内容图文
问题产生如下:
因为单位使用了过滤,访问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 选项去除。
方法二:设置代理
copy一个settings.xml到C:/Documents and Settings/username/.m2目录,并修改settings.xml文件,添加一个http代理:
<proxies> <!-- proxy | Specification for one proxy, to be used in connecting to the network. | <proxy> <id>optional</id> <active>true</active> <protocol>http</protocol> <username>proxyuser</username> <password>proxypass</password> <host>proxy.host.net</host> <port>80</port> <nonProxyHosts>local.net|some.host.com</nonProxyHosts> </proxy> --> <proxy> <id>optional</id> <active>true</active> <protocol>http</protocol> <host>www.yourproxy.com</host> <port>8080</port> </proxy> </proxies>
方法三:禁用
1.在myeclipse3.4(我用的这个版本)里面Window => Preferences => Myeclipse Enterprise Workbench => Maven4Myeclipse => Maven=>禁用Download repository index updates on startup
2.楼上的!我用的是 myeclipse7.1 以前也是和你一样没有找到!后来终于找到了!
首先你要 Window => Preferences => Myeclipse Enterprise Workbench => Maven4Myeclipse
这个里面启用 Enable Maven4Myeclipse features ,打上勾,要先启用这个插件
这样 Window => Preferences => Myeclipse Enterprise Workbench => Maven4Myeclipse => Maven
就有了!再选中就好了!
其实上面还有一项 offline 的!呵呵!我直接就把这个选上了!
【原文连接:http://www.cnblogs.com/mingforyou/archive/2013/08/23/3276864.html】
原文:http://www.cnblogs.com/wllbelief-win/p/4486744.html
内容总结
以上是互联网集市为您收集整理的(转载)解决eclipse安装maven的问题:Unable to update index for central|http://repo1.maven.org/maven2全部内容,希望文章能够帮你解决(转载)解决eclipse安装maven的问题:Unable to update index for central|http://repo1.maven.org/maven2所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。