Java Maven 2-无法计算构建计划
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18851910/
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
Maven 2- Could not calculate build plan
提问by user1888955
I set up Maven 2 on my laptop. The reason why I am still using Maven 2 is that Maven, somehow, doesn't work because of the proxy in my company.
我在笔记本电脑上设置了 Maven 2。我仍在使用 Maven 2 的原因是,由于我公司的代理,Maven 以某种方式不起作用。
The working environment: Eclipse Helio Service Release 2 Maven 2.2.1 Windows 7
工作环境:Eclipse Helio Service Release 2 Maven 2.2.1 Windows 7
The error message:
错误信息:
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
I thought it couldn't find the 2.5 jar so I downloaded it and added it into the local repository with the corresponding pom file manually, but it still can't work...
还以为找不到2.5的jar,就下载下来,手动添加到本地的仓库,加上对应的pom文件,还是不行...
Any suggestion? Thanks in advance...
有什么建议吗?提前致谢...
回答by melfore
My working solution:
我的工作解决方案:
- Close Eclipse
- Go to
c:\Users\*yourUser*\.m2\repository
directory - remove all the files called
m2e-lastUpdated.properties
present on all subdirectories - Restart eclipse, refresh and Update Maven Projects
- 关闭日食
- 进入
c:\Users\*yourUser*\.m2\repository
目录 - 删除
m2e-lastUpdated.properties
所有子目录中存在的所有文件 - 重启 Eclipse,刷新并更新 Maven 项目
My exact error was:
我的确切错误是:
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:2.4
无法计算构建计划:插件 org.apache.maven.plugins:maven-jar-plugin:2.4 或其依赖项之一无法解析:无法读取 org.apache.maven.plugins:maven-jar- 的工件描述符插件:jar:2.4
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-jar-plugin:pom:2.4 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.
引起:org.sonatype.aether.resolution.ArtifactResolutionException:从http://repo.maven.apache.org/maven2传输 org.apache.maven.plugins:maven-jar-plugin:pom:2.4 失败被缓存在本地存储库,直到中心的更新间隔已过或强制更新,才会重新尝试解析。
回答by u4840403
I have in trouble with this problem too, and my output is Could not calculate build plan: Plugin org.apache.maven.plugins:maven-war-plugin:2.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-war-plugin:jar:2.2 Plugin org.apache.maven.plugins:maven-war-plugin:2.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-war-plugin:jar:2.2
我也遇到了这个问题,我的输出是无法计算构建计划:插件 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
And I try several solutions
我尝试了几种解决方案
- List item
- clean the local repository and rerun maven install
- check out if the installation path of maven plugin is true windows>>preferences>>maven>>installations
- 项目清单
- 清理本地存储库并重新运行 maven install
- 查看maven插件的安装路径是否为true windows>>preferences>>maven>>installations
But these didn't work
但这些没有用
Finally I add something like these:
最后我添加如下内容:
<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>
And this solution worked, so add plugins in pom.xml by yourself
这个解决方案有效,所以你自己在 pom.xml 中添加插件
回答by Abhi
Adding 'maven-war-plugin' worked for me. Actually in my .m2\repository\org\apache\maven\plugins
folder there are two versions of maven-war-plugin available. So, I updated it with the latest version(in my case from 2.1.1 to 2.2).
添加 'maven-war-plugin' 对我有用。实际上在我的.m2\repository\org\apache\maven\plugins
文件夹中有两个版本的 maven-war-plugin 可用。所以,我用最新版本更新了它(在我的例子中是从 2.1.1 到 2.2)。
回答by Ramnath
Steps to resolve build plan:
解决构建计划的步骤:
- Close eclipse
- Delete all folders from .m2 repo
- Start the eclipse
- keep net connected and let maven update all dependencies
- 关闭日食
- 从 .m2 存储库中删除所有文件夹
- 开始日食
- 保持网络连接并让 Maven 更新所有依赖项
回答by Hasnaa Ibraheem
In my case, after stoping eclipse, just going to the path that it was complaining about, in your case will be:
"C:/Users/yourUser/.m2/repository/org/apache/maven/plugins/maven-war-plugin" and deleting all the files then starting eclipse has resolved the issue.
在我的情况下,在停止 eclipse 后,只需转到它抱怨的路径,在你的情况下将是:
“C:/Users/yourUser/.m2/repository/org/apache/maven/plugins/maven-war- plugin”并删除所有文件,然后启动 eclipse 已解决该问题。