Maven 2-无法计算构建计划

时间:2013-09-17 13:56:23

标签: java eclipse maven maven-2

我在笔记本电脑上设置了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文件,但它仍然无法工作......

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

5 个答案:

答案 0 :(得分:6)

我的工作解决方案:

  • 关闭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-插件:罐:2.4

引起:org.sonatype.aether.resolution.ArtifactResolutionException:无法传输org.apache.maven.plugins:来自http://repo.maven.apache.org/maven2的maven-jar-plugin:pom:2.4缓存在本地存储库中,解析在中心的更新间隔过去或强制更新之前,不会重新尝试。

答案 1 :(得分:3)

解决构建计划的步骤:

  1. 关闭eclipse
  2. 从.m2 repo
  3. 删除所有文件夹
  4. 启动eclipse
  5. 保持网络连接,让maven更新所有依赖项

答案 2 :(得分:2)

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

我尝试了几种解决方案

  • 列表项
  • 清理本地存储库并重新运行maven install
  • 检查maven插件的安装路径是否为真窗口>>首选项>> maven>>装置

但这些没有用

最后我添加了类似的内容:

<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中添加插件

答案 3 :(得分:1)

添加&#39; maven-war-plugin&#39;为我工作。实际上在我的.m2\repository\org\apache\maven\plugins文件夹中有两个版本的maven-war-plugin可用。所以,我用最新版本(在我的情况下从2.1.1到2.2)更新了它。

答案 4 :(得分:1)

在我的情况下,在停止日食之后,只是走到它抱怨的路径,在你的情况下将是:&#34; C:/Users/yourUser/.m2/repository/org/阿帕奇/行家/插件/行家-战争插件&#34;然后删除所有文件然后启动eclipse解决了这个问题。

相关问题