我试图使用Maven (m2eclipse)建立一个项目,但我在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

什么好主意吗? 如果你能告诉我如何检查是否一切配置正常,那就太有帮助了。


当前回答

在Eclipse中: 右键单击项目->Maven->更新项目->选中“快照/版本强制更新”复选框。单击OK。

其他回答

请确保。m2文件夹中的settings.XML文件是有效的 然后在cmd中使用以下命令清理存储库

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

只需删除maven本地存储库中的原型。如上所述,它发生在原型下载失败的情况下。

删除所有失败的下载:

find ~/.m2  -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;

windows:

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

然后在eclipse中右键单击您的项目,选择Maven->“更新项目…”,确保在结果对话框中选中“更新依赖项”,然后单击确定。

您可以删除.m2文件夹本身,并强制MyEclipse在启动时重新下载所有依赖项。进入Window > Preferences > MyEclipse > Maven4MyEclipse。

这在Windows中也适用。

Locate the {user}/.m2/repository (Using Juno /Win7 here) In the Search field in upper right of window, type ".lastupdated". Windows will look through all subfolders for these files in the directory. (I did not look through cache.) Remove them by Right-click > Delete (I kept all of the lastupdated.properties). Then go back into Eclipse, Right-click on the project and select Maven > Update Project. I selected to "Force Update of Snapshots/Releases". Click Ok and the dependencies finally resolved correctly.