我试图使用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 settings .xml路径。

Windows——>首选项——> Maven——>用户设置

在“用户设置”文本框中输入正确的“setting.xml”路径

其他回答

这在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.

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

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

对我来说。原因是一样的。我知道问题出在代理和防火墙上。

这是我的解决方案 第一种方法:1。安装代理Maven和Eclipse 2。执行“定位{user}/”。*. m2/repository,删除所有*.3.最后更新文件回到Eclipse,右键单击项目并选择Maven > Update project。>选择“快照/版本强制更新”。

如果项目仍然存在错误。例子:这里是我的问题之后所有以上步骤

Failure to transfer org.apache.maven:maven-archiver:pom:2.5 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:maven-archiver:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect timed out

我使用这个对我有用的解决方案: 1. 在https://mvnrepository.com/中查找存储库。将依赖项复制到我的*。Poml项目实例

<dependency>
    <groupId>org.apache.maven</groupId>
    <artifactId>maven-archiver</artifactId>
    <version>2.5</version>
</dependency>

3.构建项目。缺失的依赖项将被下载到本地存储库。 4. 回到Eclipse,右键单击项目并选择Maven > Update project。>选择“快照/版本强制更新”。=>>错误已解决在完成和解决后,我在第2步删除依赖项。 完成

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

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