开发者

m2eclipse cannot update index from central repo

I have just downloaded and installed M2Eclipse, but it fails to update the index of the central repo. At the same time, Maven itself is able to download artifacts from the repo (via command line).

I had the settings.xml file开发者_高级运维 in maven/conf, and I copied it to .m2/ directory, but it didn't help.

I have proxy, but proxy settings are given in settings.xml - commands from command line work fine, but not in Eclipse. In Eclipse it gives me this:

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

UPDATE:

This is what I get when I try to create a new Maven Project:

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)


Please check your m2eclipse installations configuration, have you pointed it to the correct settings.xml file ?

m2eclipse cannot update index from central repo


Just add this mirror to the settings.xml:

<mirror>
  <id>ibiblio.org</id>
  <url>http://mirrors.ibiblio.org/maven2</url>
  <mirrorOf>central</mirrorOf>
</mirror>


if you are behind a proxy do your proxy settings on your usersettings file as below

<proxies>
    <proxy>
        <id>myId</id>
        <active>true</active>
        <protocol>http</protocol>
        <username>MyUser</username>
        <password>MyPassword</password>
        <host>my.proxy.host</host>
        <port>myproxyport</port>
        <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
</proxies>


Changes in both global and user specific settings/xml are needed in order custom maven installation to work inside eclipse. I don't know why but it helped for me.


If the problem is not about connection/proxy, try a more drastic way: delete the whole .metadata folder. Later import projects from their place or checkout them from the svn(if you use some). This is not much more complicated, but it helped. the problem is that we don't really know, what metadata are broken, so the natural next step is to delete all of them. I think, it is the deepest possible cleaning before reinstallation of Eclipse + plugins.


To avoid having to change the settings in 2 places and just rely on the global settings this works nicely:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜