【问题标题】:Maven 2- Could not calculate build planMaven 2-无法计算构建计划
【发布时间】:2013-09-17 13:56:22
【问题描述】:

我在笔记本电脑上设置了 Maven 2。我仍在使用 Maven 2 的原因是 Maven 不知何故因为我公司的代理而无法工作。

工作环境: Eclipse Helio 服务版本 2 Maven 2.2.1 视窗 7

错误信息:

Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'StrutsExample'.
Could not calculate build plan: 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
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
Could not calculate build plan: 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
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

我以为找不到2.5的jar所以我下载了它并手动将其添加到本地存储库中并带有相应的pom文件,但仍然无法使用...

有什么建议吗?提前谢谢...

【问题讨论】:

  • 你在settings.xml中配置代理了吗?
  • 是的,我已经在设置文件中配置了代理...@khmarbaise
  • 尝试删除本地 repo 并重试构建?
  • 获取生命周期配置未涵盖的插件执行:org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile(执行:default-testCompile,阶段:test-compile)

标签: java eclipse maven maven-2


【解决方案1】:

我的工作解决方案:

  • 关闭 Eclipse
  • 转到c:\Users\*yourUser*\.m2\repository目录
  • 删除所有子目录中所有名为 m2e-lastUpdated.properties 的文件
  • 重启 eclipse,刷新和更新 Maven 项目

我的确切错误是:

无法计算构建计划:插件 org.apache.maven.plugins:maven-jar-plugin:2.4 或其依赖项之一无法解析:无法读取 org.apache.maven.plugins:maven 的工件描述符-jar-plugin:jar:2.4

原因:org.sonatype.aether.resolution.ArtifactResolutionException: org.apache.maven.plugins:maven-jar-plugin:pom:2.4 从http://repo.maven.apache.org/maven2 传输失败被缓存在本地存储库中,解析不会重新尝试,直到中心的更新间隔已过或强制更新。

【讨论】:

  • 这真是一团糟。不得不做同样的事情,但真的不确定根本原因。
【解决方案2】:

解决构建计划的步骤:

  1. 关闭日食
  2. 从 .m2 存储库中删除所有文件夹
  3. 启动 Eclipse
  4. 保持网络连接并让 maven 更新所有依赖项

【讨论】:

  • 尝试了同样的方法,但似乎没有解决我的问题。请您提出任何其他解决方案。
【解决方案3】:

我也遇到了这个问题,我的输出是 无法计算构建计划:插件 org.apache.maven.plugins:maven-war-plugin:2.2 或其依赖项之一无法解析:无法读取 org.apache.maven.plugins:maven-war- 的工件描述符plugin:jar:2.2 Plugin org.apache.maven.plugins:maven-war-plugin:2.2 或其依赖项之一无法解析:无法读取 org.apache.maven.plugins:maven-war-plugin 的工件描述符:jar:2.2

我尝试了几种解决方案

  • 列表项
  • 清理本地存储库并重新运行 maven install
  • 查看maven插件的安装路径是否为true windows>>preferences>>maven>>installations

但这些都不起作用

最后我添加如下内容:

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.4.3</version>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1.1</version>
        <configuration>
            <webResources>
                <resource>
                    <directory>src/main/webapp</directory>
                    <excludes>
                        <exclude>**/*.jpg</exclude>
                    </excludes>
                </resource>
            </webResources>
        </configuration>
    </plugin>
</plugins>

这个解决方案有效,所以你自己在 pom.xml 中添加插件

【讨论】:

    【解决方案4】:

    在我的情况下,在停止 eclipse 之后,只是去它抱怨的路径,在你的情况下将是:
    “C:/Users/yourUser/.m2/repository/org/apache/maven/ plugins/maven-war-plugin" 并删除所有文件然后启动 eclipse 解决了这个问题。

    【讨论】:

      【解决方案5】:

      添加“maven-war-plugin”对我有用。实际上在我的.m2\repository\org\apache\maven\plugins 文件夹中有两个版本的 maven-war-plugin 可用。所以,我用最新版本更新了它(在我的例子中是从 2.1.1 到 2.2)。

      【讨论】:

        猜你喜欢
        • 2013-04-26
        • 2018-11-25
        • 2015-09-25
        • 2017-09-28
        • 2018-01-08
        • 2018-03-02
        • 1970-01-01
        • 2018-07-10
        • 2014-03-21
        相关资源
        最近更新 更多