问题产生如下:
因为单位使用了过滤,访问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 的!呵呵!我直接就把这个选上了!

解决eclipse安装maven的问题:Unable to update index for central|http://repo1.maven.org/maven2的更多相关文章

  1. Unable to update index for central http://repo1.maven.org/maven2/ 解决方法

    不知道什么原因 MyEclipse(eclipse) 中的 maven 插件突然不能用了,修改 pom.xml 无任何反应 控制台报 Unable to update index for centra ...

  2. [转]使用Maven添加依赖项时(Add Dependency)时,没有提示项目可用,并且在Console中,输出: Unable to update index for central|http://repo1.maven.org/maven2 。

    使用Maven添加依赖项时(Add Dependency)时,没有提示项目可用,并且在Console中,输出: Unable to update index for central|http://re ...

  3. Unable to update index for central

    Unable to update index for central http://repo1.maven.org/maven2/ 就是这句,myeclipse启动后控制台输出这句话:解决办法:1.在 ...

  4. 解决m2eclipse之Unable to update index for central |

    maven 不能更新,真烦人,转载他人的 maven是个好东西,eclipse上的maven插件m2eclipse也非常方便,但是最近这个东西经常无法连接到maven index的更新网站,然后ecl ...

  5. 彻底解决m2eclipse之Unable to update index for central

    原文链接:https://my.oschina.net/itblog/blog/208581 maven是个好东西,eclipse上的maven插件m2eclipse也非常方便,但是最近这个东西经常无 ...

  6. Unable to update index for nexus-publish | http://ip:port/repository/maven-public/

    问题描述:Unable to update index for nexus-publish | http://ip:port/repository/maven-public/ 解决方案:进入工作空间. ...

  7. 解决MyEclipse开启后总是不停的在Update index

    近期MyEclipse开启之后总是不停的在 update index,非常是耗时间. 查找资料发现Update index...是Maven在不断更新, 解决的方法例如以下: Window --> ...

  8. maven课程 项目管理利器-maven 3-4 eclipse安装maven插件和新建maven项目

    本节主要讲了两个主要内容, 1       eclipse安装maven插件 2 新建maven项目 3 本人实操 1       eclipse安装maven插件 eclipse4.0以上和myec ...

  9. Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central

    问题: maven安装完成,环境变量配置没有问题,cmd窗口运行mvn compile的时候报错如下: Plugin org.apache.maven.plugins:maven-resources- ...

随机推荐

  1. 20155225 2006-2007-2 《Java程序设计》第四周学习总结

    20155225 2006-2007-2 <Java程序设计>第四周学习总结 教材学习内容总结 对"是一种"语法测试几次之后,总结一句:满足"是一种" ...

  2. Master和worker模式

    让和hadoop的设计思想是一样的,Master负责分配任务和获取任务的结果,worker是真正处理业务逻辑的. 使用ConcurrentLikedQueue去承载所有的任务,因为会有多个worker ...

  3. Ansible之迭代、模板

    本节内容: 迭代 模板(JInjia2相关) Jinja2相关 一.迭代 当有需要重复性执行的任务时,可以使用迭代机制.其使用格式为将需要迭代的内容定义为item变量引用,并通过with_items语 ...

  4. bzoj 4552

    4552 思路: 二分线段树: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 100005 #define ...

  5. nginx、php-fpm、swoole HTTP/TCP压测对比

    本次测试是在win7下docker环境中进行压测,共创建一个nginx容器.一个php-fpm容器和一个swoole容器,客户端请求nginx服务器,nginx接收用户访问请求并转发给php-fpm, ...

  6. Java使用AES加密解密

    AES加密机制: 密码学中的高级加密标准(Advanced Encryption Standard,AES),又称Rijndael加密法,是美国联邦政府采用的一种区块加密标准. 这个标准用来替代原先的 ...

  7. Java 集合之 Collection

    集合就是一组数的集合,就像是一个容器,但是我们应该清楚的是集合中存放的都是对象的引用,而不是真正的实体.而我们常说的集合中的对象其实指的就是对象的引用. 我们可以把集合理解为一个小型数据库,用于存放数 ...

  8. Bzoj1018/洛谷P4246 [SHOI2008]堵塞的交通(线段树分治+并查集)

    题面 Bzoj 洛谷 题解 考虑用并查集维护图的连通性,接着用线段树分治对每个修改进行分治. 具体来说,就是用一个时间轴表示图的状态,用线段树维护,对于一条边,我们判断如果他的存在时间正好在这个区间内 ...

  9. 在qemu上运行BusyBox

    BusyBox 前文“在qemu环境中用gdb调试Linux内核”和“Initramfs 原理和实践”分别描述了怎么用qemu来运行一个编译好的内核,以及怎么指定initramfs,但都是简单的演示. ...

  10. java UTF8 HEX

    private final static char[] hexArray = "0123456789ABCDEF".toCharArray(); public static Str ...