Maven问题1:Failure to transfer org.apache.maven

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/gsycwh/article/details/52792633

Maven报错:Failure to transfer org.apache.maven

在创建Maven项目时,经常会在pom.xml的第一行处报错,提示信息如下:

Failure to transfer org.apache.maven:maven-surefire-plugin:jar:2.5 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-
archiver:jar:2.5 from/to central (http://repo.maven.apache.org/maven2): The
operation was cancelled.


其主要的原因是因为maven的plugin并未下载到本地
解决问题的办法很简单:


步骤一:你可以到本地库中搜索“.lastUpdated”结尾的文件,找到一份
maven-surefire-plugin-2.7.1.pom.lastUpdated的文件,将其删除。如未自行设置,本地仓库为C:\Users\admin.m2\repository。


步骤二: 回到项目中,在项目右键点击project -> Maven -> Update Dependencies(Update Project…)更新项目,这时候应该就没有错了。

注意的是:maven-surefire-plugin-2.7.1.pom.lastUpdated文件不是固定的,而是要看报错的具体信息,如上面错误信息中,主要看报错的maven:后面紧跟的信息,在上面的错误信息中,我用加粗标识出来了。



发表人:梦想的边缘

猜你喜欢

转载自blog.csdn.net/gsycwh/article/details/52792633