m2eclipse无法从中央仓库更新索引

我刚刚下载并安装了M2Eclipse,但无法更新中央仓库的索引。 同时,Maven本身可以从repo下载工件(通过命令行)。

我在maven/confsettings.xml文件,并将其复制到.m2/目录,但它没有帮助。

我有代理,但是在settings.xml中给出了代理设置 – 来自命令行的命令工作正常,但在Eclipse中没有。 在Eclipse中它给了我这个:

 Unable to update index for central|http://repo1.maven.org/maven2 

更新:

这是我尝试创建一个新的Maven项目时得到的:

 Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE from any of the configured repositories. Could not resolve artifact Failed to resolve version for org.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xml in local (C:\Documents and Settings\user\.m2\repository) Failed to resolve version for org.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xml in local (C:\Documents and Settings\user\.m2\repository) 

请检查您的m2eclipse安assembly置,您是否已将其指向正确的settings.xml文件?

在此处输入图像描述

只需将此镜像添加到settings.xml

  ibiblio.org http://mirrors.ibiblio.org/maven2 central  

如果您在代理服务器后面,请在您的usersettings文件上执行代理设置,如下所示

   myId true http MyUser MyPassword my.proxy.host myproxyport local.net|some.host.com   

需要在全局和用户特定设置/ xml中进行更改才能使自定义maven安装在eclipse中工作。 我不知道为什么,但它对我有帮助。

如果问题不是关于连接/代理,请尝试更激烈的方法:删除整个.metadata文件夹。 稍后从他们的地方导入项目或从svn签出(如果你使用的话)。 这并不复杂,但它有所帮助。 问题是我们并不真正知道什么元数据被破坏,所以下一步自然就是删除所有元数据。 我认为,在重新安装Eclipse +插件之前,这是最彻底的清理。

为了避免必须在2个地方更改设置,只需依赖全局设置,这很有效:

 ln -s /etc/maven2/settings.xml ~/.m2/settings.xml