Java eclipse (pom.xml) 中的 Maven 错误:无法传输 org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25447590/
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 error in eclipse (pom.xml) : Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4
提问by AHméd Net
I wanna make web project using the Maven to import automatically all libraries that I need, so I chose "maven-archetype-webpp"
我想使用 Maven 制作 web 项目来自动导入我需要的所有库,所以我选择了 "maven-archetype-webpp"
after that I got this error on pom.xml file :
之后,我在 pom.xml 文件上收到此错误:
Description Resource Path Location Type Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 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.plugins:maven-surefire-plugin:pom:2.12.4 from/to central (http://repo.maven.apache.org/maven2): The operation was cancelled. pom.xml /SpringTuto line 1 Maven Configuration Problem
I've updated my Maven project but with no results !!
我已经更新了我的 Maven 项目,但没有结果!!
POM.XML :
POM.XML :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.pre.example</groupId>
<artifactId>SpringTuto</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>SpringTuto Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>SpringTuto</finalName>
</build>
</project>
回答by Mohamed NAOUALI
You need just to follow those steps:
您只需按照以下步骤操作:
- Right Click on your project: Run (As) -> Maven clean
- Right Click on your project: Run (As) -> Maven install
- 右键单击您的项目:Run (As) -> Maven clean
- 右键单击您的项目:Run (As) -> Maven install
After which, if the build fails when you do Maven Install, it means there is no web.xml file under WEB-INF or some problem associated with it. it really works
之后,如果在执行 Maven Install 时构建失败,则表示 WEB-INF 下没有 web.xml 文件或与之相关的一些问题。真的行
回答by pae de anto
just right click on your project, hover maven then click update project.. done!!
只需右键单击您的项目,将 Maven 悬停然后单击更新项目..完成!!
回答by rahulnikhare
Right click on project-> Maven->Click checked box 'Force Update'->Update
右键单击项目-> Maven-> 单击复选框“强制更新”-> 更新
回答by lilalinux
In my case it was a failed import to eclipse. I had to delete the project from eclipse (without deleting form the filesystem of course) and reimport it. After that the error was gone immediately.
在我的情况下,导入 eclipse 失败。我不得不从 Eclipse 中删除该项目(当然不删除文件系统)并重新导入它。之后,错误立即消失了。
回答by harun ugur
Right Click on your project: Run (As) -> Maven clean Right Click on your project: Run (As) -> Maven install
右键单击您的项目:Run (As) -> Maven clean 右键单击您的项目:Run (As) -> Maven install
回答by Arijeet _Tech
For Unix Users
对于 Unix 用户
find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
Right-click your project and choose Update Dependencies
右键单击您的项目并选择更新依赖项
For Windows
对于 Windows
- CD (change directory) to .m2\repository
- execute the command
for /r %i in (*.lastUpdated) do del %i
- Then right-click your project and choose Update Dependencies
- CD(更改目录)到 .m2\repository
- 执行命令
for /r %i in (*.lastUpdated) do del %i
- 然后右键单击您的项目并选择更新依赖项
回答by amanzoor
In my case eclipse was using an old settings.xml file.
就我而言,eclipse 使用的是旧的 settings.xml 文件。
回答by Sony Mathew
If you are using Eclipse Neon, try this:
如果您使用的是 Eclipse Neon,请尝试以下操作:
1) Add the maven plugin in the properties section of the POM:
1)在POM的属性部分添加maven插件:
<properties>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
2) Force update of project snapshot by right clicking on Project
2)通过右键单击项目强制更新项目快照
Maven -> Update Project -> Select your Project -> Tick on the 'Force Update of Snapshots/Releases' option -> OK
Maven -> 更新项目 -> 选择你的项目 -> 勾选“强制更新快照/发布”选项 -> 确定