创建 maven 项目的时候遇到的问题

Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from https://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-resources-plugin:pom:2.6 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled.

 

一直提醒出现如上的问题,网上查了一些,都没解决。有些让在 pom 文件里添加一个依赖在 install 一下,并没用。还有些说 

打开maven的本地库...\repository\org\apache\maven\plugins\maven-surefire-plugin\2.10会发现:里面少只有一个maven-surefire-plugin-2.10.pom.lastUpdated,而没有maven-surefire-plugin-2.10.jar
解决方法: 
1.删除maven-surefire-plugin-2.7.1.pom.lastUpdated文件
2.右键点击project -> Maven - Update Dependencies

依旧解决不了。

最终的解决办法是:

可能是你之前下载的有失败的,所以将之前的全部删掉

cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i

如上所示,删掉后,再右击你的 project,选择 Maven->"Update Project ...",确保在结果对话框中选中“Update Dependencies”,然后单击“确定”即可。

等待 eclipse 下载吧!

posted @ 2019-11-13 21:56  意无尽  阅读(333)  评论(0编辑  收藏  举报