Eclipse 中的 Pom 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19056829/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 21:54:20  来源:igfitidea点击:

Pom error in Eclipse

eclipsemavenm2e

提问by Adrian Ber

I have a Maven project in Eclipse and if I try to run Maven > Update projectI get the following error

我在 Eclipse 中有一个 Maven 项目,如果我尝试运行,Maven > Update project我会收到以下错误

Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from http://repo.maven.apache.org/maven2was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): java.net.ConnectException: connection timed out to http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom

org.apache.maven.plugins:maven-resources-plugin:pom:2.5 从http://repo.maven.apache.org/maven2传输失败被缓存在本地存储库中,直到更新间隔才会重新尝试解析中央的已过期或强制更新。原始错误:无法传输工件 org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central ( http://repo.maven.apache.org/maven2): java.net.ConnectException:与http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom 的连接超时

  • I tried to run Maven with the embedded installation and an external one - same result.
  • I don't have any proxy set up in Eclipse and I don't need one.
  • I do not reference the plugin in my POM.
  • Running mvn eclipse:eclipsein console works perfectly.
  • I'm using Eclipse Kepler and m2e 1.4.0.201.
  • 我尝试使用嵌入式安装和外部安装运行 Maven - 结果相同。
  • 我没有在 Eclipse 中设置任何代理,我也不需要。
  • 我没有在我的 POM 中引用该插件。
  • 运行mvn eclipse:eclipse在控制台完美。
  • 我正在使用 Eclipse Kepler 和 m2e 1.4.0.201。

The parent POM is

父 POM 是

<parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
</parent>

Anyone have any idea why?

任何人都知道为什么?

回答by Adrian Ber

Adding

添加

<pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.6</version>
        </plugin>
    </plugins>
</pluginManagement>

solved the problem.

解决了这个问题。

回答by Simeon Leyzerzon

Here's the error I was getting initially:

这是我最初遇到的错误:

Failure to transfer org.sonatype.oss:oss-parent:pom:9 from http://repo.maven.apache.org/maven2was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.sonatype.oss:oss-parent:pom:9 from/to central (http://repo.maven.apache.org/maven2): Address family not supported by protocol family: connect

org.sonatype.oss:oss-parent:pom:9 从http://repo.maven.apache.org/maven2传输失败 被缓存在本地存储库中,直到 central 的更新间隔已过才会重新尝试解析或强制更新。原始错误:无法传输工件 org.sonatype.oss:oss-parent:pom:9 from/to central ( http://repo.maven.apache.org/maven2):协议系列不支持地址系列:连接

I didn't need to introduce any additional maven plugins, simply enclosing the existing plugins inside <pluginManagement>tag as described here: How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Buildssolved it for me - hopefully it will help someone else as well.

我不需要引入任何额外的 Maven 插件,只需将现有插件包含在<pluginManagement>标签中,如下所述:如何解决 Spring Data Maven Builds 的“生命周期配置未涵盖的插件执行”为我解决了这个问题 - 希望它会帮助某人其他也一样。