m2eclipse无法从*repo更新索引

时间:2023-01-24 23:02:35

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).

我刚刚下载并安装了M2Eclipse,但是它没有更新*repo的索引。同时,Maven本身可以从repo(通过命令行)下载工件。

I had the settings.xml file in maven/conf, and I copied it to .m2/ directory, but it didn't help.

我有设置。在maven/conf中的xml文件,我将它复制到.m2/目录中,但是没有帮助。

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:

我有代理,但是代理设置是在设置中给出的。来自命令行的命令可以正常工作,但在Eclipse中不行。在《月蚀》中,它告诉我:

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:

当我尝试创建一个新的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)

6 个解决方案

#1


7  

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

请检查您的m2eclipse安装配置,是否已将其指向正确的设置。xml文件吗?

m2eclipse无法从*repo更新索引

#2


7  

Just add this mirror to the settings.xml:

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

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

#3


4  

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>

#4


2  

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.

为了让自定义maven安装在eclipse中工作,需要修改全局和用户特定的设置/xml。我不知道为什么,但这对我有帮助。

#5


0  

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.

如果问题不在于连接/代理,请尝试更激烈的方式:删除整个.metadata文件夹。稍后从它们的位置导入项目或从svn签出项目(如果您使用了一些)。这并没有复杂得多,但它起到了作用。问题是我们不知道,什么元数据被破坏了,所以自然的下一步是删除所有的元数据。我认为,这是在重新安装Eclipse +插件之前最深入的清理。

#6


-2  

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

#1


7  

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

请检查您的m2eclipse安装配置,是否已将其指向正确的设置。xml文件吗?

m2eclipse无法从*repo更新索引

#2


7  

Just add this mirror to the settings.xml:

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

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

#3


4  

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>

#4


2  

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.

为了让自定义maven安装在eclipse中工作,需要修改全局和用户特定的设置/xml。我不知道为什么,但这对我有帮助。

#5


0  

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.

如果问题不在于连接/代理,请尝试更激烈的方式:删除整个.metadata文件夹。稍后从它们的位置导入项目或从svn签出项目(如果您使用了一些)。这并没有复杂得多,但它起到了作用。问题是我们不知道,什么元数据被破坏了,所以自然的下一步是删除所有的元数据。我认为,这是在重新安装Eclipse +插件之前最深入的清理。

#6


-2  

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