eclipse pom.xml Maven 构建中的错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21721357/
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
Error in pom.xml Maven build
提问by Chirag
I am getting an error in my pom.xml when trying to build a maven project. The error is here on this plugin:
尝试构建 maven 项目时,我的 pom.xml 中出现错误。这个插件的错误在这里:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
This is the error Eclipse shows:
这是 Eclipse 显示的错误:
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:
2.3.2:compile (execution: default-compile, phase: compile)
- CoreException: Could not get the value for parameter compilerId for plugin execution default-compile:
PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not
be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 ():
ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven:maven-toolchain:jar:1.0:
ArtifactResolutionException: Failure to transfer org.apache.maven:maven-toolchain:pom:1.0 from 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. Original error: Could not transfer artifact org.apache.maven:maven-toolchain:pom:1.0 from/to central (http://
repo.maven.apache.org/maven2): The operation was cancelled.
回答by aldrinleal
Seems like the resolution failed.
好像解析失败了。
Run mvn with the -U
flag to disregard the cache and re-attempt resolution
运行带有-U
标志的mvn以忽略缓存并重新尝试解析
(the alt+f5 dialog might help as well)
(alt+f5 对话框也可能有帮助)
回答by SebastianH
When I ran into this problem I figured out that it was due to a previous network problem. The local Maven repository avoids immediate reattempts. The best way to solve this was to use the eclipse "Update Maven Project" (ALT+F5) feature end check the option "Force Update of Snapshots/Releases".
当我遇到这个问题时,我发现这是由于之前的网络问题。本地 Maven 存储库避免立即重新尝试。解决此问题的最佳方法是使用 Eclipse“更新 Maven 项目”(ALT+F5) 功能结束检查选项“强制更新快照/发布”。
回答by ravi katiyar
This was not working for me , changing maven compiler version to 2.5.1 finally worked for me , hopefully this comes to rescue for anyone still struggling with this dependency
这对我不起作用,将 maven 编译器版本更改为 2.5.1 最终对我有用,希望这对仍在与这种依赖关系苦苦挣扎的人有所帮助
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
回答by Abhishek
Update Maven Project by pressing (ALT+F5) and select the option "Force Update of Snapshots/Releases".
按 ( ALT+ F5)更新 Maven 项目,然后选择“强制更新快照/发布”选项。
回答by Aslam Khan
Update Maven Project by pressing (ALT+F5) and select the option "Force Update of Snapshots/Releases". works for me also
按 (ALT+F5) 更新 Maven 项目并选择“强制更新快照/发布”选项。也适用于我