且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法计算构建计划:插件 org.apache.maven.plugins:maven-resources-plugin:2.5 或其依赖项之一无法解析

更新时间:2022-04-20 22:52:04

我遇到了完全相同的问题.

I had the exact same problem.

[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: Failure to find org.apache.maven.plugins:maven-resources-plugin:pom:2.5 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
...

有 maven 3.0.5,安装了 JBoss Dev Studio 7 的 eclipse Kepler.计算机坐在内部网络与代理到互联网.这就是我所做的.

Had maven 3.0.5, eclipse Kepler with JBoss Dev Studio 7 installed. Computer sitting on internal network with proxy to the internet. Here's what I did.

0.检查 Maven 存储库服务器是否已启动

1.检查代理是否已设置并正常工作

首先我认为这是一个代理问题,我确保 maven settings.xml 包含代理设置(settings.xml 可以存在于 MAVEN_HOME 中的两个地方.另一个在 %userprofile%.m2 中,后者具有更高的优先级):

First I thought it was a proxy problem, I made sure that maven settings.xml contained the proxy settings (settings.xml can exist in two places one in MAVEN_HOME. The other in %userprofile%.m2 with the later having higher precedence):

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <username>optional-proxyuser</username>
  <password>optional-proxypass</password>
  <host>proxy.host.net</host>
  <port>80</port>
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>

并通过尝试 telnet 来检查代理是否正常工作:

and checked that the proxy is working by trying to telnet to it:

telnet [proxy] [port number]

2.检查不是 Eclipse 问题

在 eclipse 之外的命令行级别运行 'mvn compile' - 同样的问题.

ran 'mvn compile' at command line level outside of eclipse - same issue.

如果 'mvn compile' 有效.但是在 Eclipse 中使用 maven 插件不起作用,请参阅 Maven plugin not usingeclipse的代理设置

If 'mvn compile' worked. But it doesn't work using the maven plugin in eclipse, see Maven plugin not using eclipse's proxy settings

3.检查不缓存问题删除了我本地 Maven 存储库中的所有内容.(默认位置:~/.m2/repository)然后重新运行 maven - 出现了同样的问题.

3. Check not Cache Issue Deleted all contents in my local maven repository. (Default location: ~/.m2/repository) And then reran maven - same issue came up.

4.什么对我有用

自动下载 &安装缺少的插件:通过在 pluginManagement 的 POM 文件构建部分声明缺少的插件,Maven 将自动检索所需的插件.在 POM 文件中,为您需要的插件版本添加以下代码:

Automatically download & install missing plugin: By declaring the missing plugin in the POM file build section for pluginManagement Maven will automatically retrieve the required plugin. In the POM file, add this code for the version of the plugin you require:

  <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-resources-plugin</artifactId>
              <version>2.7</version>
            </plugin>           
          </plugins>
        </pluginManagement>   
    </build>

手动安装缺少的插件:我去了 http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5 并下载 maven-resources-plugin-2.5.jarmaven-resources-plugin-2.5.pom .将其直接复制到 maven 存储库中的正确文件夹(~/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.5)并重新运行mvn compile".这解决了问题.

Manually install missing plugin: I went to http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5 and downloaded maven-resources-plugin-2.5.jar and maven-resources-plugin-2.5.pom . Copied it directly into the maven repository into the correct folder ( ~/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.5) and reran 'mvn compile'. This solved the problem.

编辑1

在此之后,mvn install"还有两个问题:

Following this I had another two problem with 'mvn install':

The POM for org.apache.maven.plugins:maven-surefire-plugin:jar:2.10 is missing, no dependency information available

The POM for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1 is missing, no dependency information available

我以与上述相同的方式解决了这个问题,从 http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin/2.10http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin/2.3.1一个>

I approached this problem the same way as above, downloading from http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin/2.10 and http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin/2.3.1