使用eclipse的m2e插件创建maven工程时,eclipse开始更新本地仓库,我这网速太慢,就给强制停止了。然后pom就报了一堆的错误,如下:
Description Resource Path Location Type
Failure to transfer com.thoughtworks.xstream:xstream:jar:1.4.3 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 com.thoughtworks.xstream:xstream:jar:1.4.3 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000 pom.xml /testweb line 1 Maven Configuration Problem
国内baidu到的解决方案都不靠谱,照例看老外的解决方式,原文如下:
i am trying to set up a project using Maven (m2eclipse), but I get this error in Eclipse:
Description Resource Path Location Type Could not calculate build plan: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.0.2 from http://repo1.maven.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-compiler-plugin:pom:2.0.2 from/to central (http://repo1.maven.org/maven2): No response received after 60000 ExampleProject Unknown Maven Problem
Any ideas? It would be helpful if you could show me how to check if everything is configured fine...
Remove all your failed downloads:
find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
For windows:
cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i
Then rightclick on your project in eclipse and choose Maven->"Update Project ...", make sure "Update Dependencies" is checked in the resulting dialog and click OK.
大致意思就是:
问:在使用m2eclipse创建maven工程时遇到这个问题,如何解决?
答:删除所有失败的更新(即仓库中所有以.lastUpdated结尾的文件)。
linux下cd到maven本地仓库目录,执行:
find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
window下cd到maven本地仓库目录,执行:
for /r %i in (*.lastUpdated) do del %i
然后到工程中选择 Maven->"Update Project ..."。
OK,按老外的方式,jar包重新开始下载,问题解决。