我试图使用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

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


当前回答

删除所有失败的下载:

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->“更新项目…”,确保在结果对话框中选中“更新依赖项”,然后单击确定。

其他回答

这对我来说在Windows上很管用:

找到{user}/.m2/存储库 在窗口右上方的搜索栏中,输入“.lastupdated”。Windows将在该目录下的所有子文件夹中查找这些文件。 删除所有的.lastupdated文件。 回到Eclipse,右键单击项目并选择Maven > Update project。 选择“强制更新快照/版本”。 单击Ok,依赖项最终将正确解析。

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

当我在防火墙后面时,它发生在我身上。在Eclipse IDE中运行时,有时不会下载依赖项。确保使用mvn clean install -U来解决这个问题。在此之后,您将看到依赖项下载。

这件事也发生在我身上,对此你可能有两种解决办法

If your project consist of some external or project specificdependency in it then you have to manually add it to your M2 repo folder which is located at C:\Users\Mohit.Singh.m2\repository folder and then you have to run mvn eclipse:eclipse and then mvn clean install from the project folder if you do not have any wxternal or project sppecific dependency then you may import the project into eclipse as Existing maven project then right click on project --> GO to maven --> Click on update project a window will appear check the force snapshot download option and hit on OK

由于删除了'maven-compiler-plugin 2.0.2'而出现上述错误 来自maven存储库。 对我来说,当我将'maven-compiler-plugin'降级到2.0或2.0.1版本时,上述错误得到了解决。