繁体   English   中英

Maven 2-无法计算构建计划

[英]Maven 2- Could not calculate build plan

我在笔记本电脑上设置了 Maven 2。 我仍在使用 Maven 2 的原因是,由于我公司的代理,Maven 以某种方式不起作用。

工作环境:Eclipse Helio Service Release 2 Maven 2.2.1 Windows 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文件,还是不行...

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

我的工作解决方案:

  • 关闭日食
  • 转到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- 的工件描述符插件:jar:2.4

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

解决构建计划的步骤:

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

我也遇到了这个问题,我的输出是无法计算构建计划:插件 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 中添加插件

就我而言,在停止 eclipse 后,只需转到它抱怨的路径,就您而言,它将是:
“C:/Users/yourUser/.m2/repository/org/apache/maven/plugins/maven-war-plugin”并删除所有文件然后启动 eclipse 已解决该问题。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM