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

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


尝试执行

mvn -U clean

或者在eclipse中运行> Maven Clean和Maven >更新项目上下文菜单中的快照

如果你是一个代理,你必须更新settings.xml文件(在你的MAVEN_HOME的conf文件夹下,文件本身包含关于代理设置的信息),另外你可能需要更新你的Eclipse网络设置(窗口->Preferences…)—>类型Network Connections)。

尝试使用-X或——debug来获得调试输出,这可以提供关于问题的额外信息。

谢谢你的回复,但经过更多的搜索,我能够解决这个问题。结果我不得不删除其中一个“*”。lastUpdated”,这是阻止我的一个插件(Maven Surefire插件)更新。我是手动清理的,因为清洁专家显然不会这么做。

问题是“*”。一个插件的lastUpdated文件阻止了maven检查更新,并且不允许下载必要的jar文件。

我在Eclipse 3.6和m2eclipse中有类似的问题。

无法计算构建计划:未能将org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3从http://repo1.maven.org/maven2传输到本地存储库中,直到central的更新间隔已过或强制更新,才会重新尝试解决方案。原始错误:无法从中心转移工件org.apache.maven.plugins: Maven -resources-plugin:jar:2.4.3 (http://repo1.maven.org/maven2): ConnectException project1未知Maven问题

删除所有maven*。来自本地存储库的lastUpdated文件(正如Deepak Joy建议的那样)解决了这个问题。

删除所有失败的下载:

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

设置。xml代理? 在eclipse中有maven全局\本地配置文件,添加settings.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.

我的工作空间里只有几个项目也有类似的问题。其他具有几乎相同pom的项目根本没有错误。列出的其他答案都不能解决我的问题。我最终无意中为每个项目删除/重新应用Maven特性,错误消失了:

对于每个项目,有一个pom与“决议将不会被重新尝试…”错误:

在Eclipse中右键单击项目并选择Maven->Disable Maven Nature 右键单击Eclipse中的项目并选择Configure->Convert to Maven project

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

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

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

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

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

在eclipse中给出正确的maven settings .xml路径。

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

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

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

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

对我来说,我只是在POM.xml文件中添加了下面的xml代码。在我右键单击项目-> Maven ->更新项目后,我检查了快照/发布的强制更新**,一切正常

    <dependencies>
        <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/javax.servlet.jsp/jsp-api -->
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/jstl/jstl -->
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

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

这是我的解决方案 第一种方法: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步删除依赖项。 完成

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

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

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

对我来说有效的解决方法如下:

将依赖项复制到pom。 < >的依赖 < groupId > org.apache.maven < / groupId > < artifactId > maven-archiver < / artifactId > <版本> 2.5版本> < / < / >的依赖 右击您的项目 选择Maven 选择更新项目 选择“强制更新快照/发布”

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

对于mac

我删除了所有旧的maven失败的下载,在我的mac上也有几个版本的maven

寻找~ /。M2 -name "*。lastUpdated" -exec grep -q " cannot transfer" {};-print -exec rm {};

之后,我简单地更新了我的eclipse

帮助->检查更新

这个问题为我解决了

这个问题的主要原因是失败的旧更新不允许你下载原型,所以如果你试图在maven的任何原型中构建项目,它会失败

创建一个文件delete_lastUpdated_and_remote.sh(使用\n):

#!/bin/bash
find $(cd $(dirname $0); pwd) -name "*.lastUpdated" -type f -print -exec rm -rf {} \;
find $(cd $(dirname $0); pwd) -name "_remote.repositories" -type f -print -exec rm -rf {} \;

把它放在本地Maven repo中,例如%userprofile%\。M2 \repository或~/。M2 /repository,并运行它。

在windows中,你也应该安装Git来运行sh文件。

我也用在jenkins的工作上。

删除存储库中的所有文件。

转到c:\ users \ dell。M2 \资源库,选择所有文件并删除它。

然后转到项目,右键单击maven更新项目(Alt+F5)。它将下载存储库中的所有依赖文件。

我得到这个错误的插件如下:

<groupId>org.codehaus.mojo</groupId>  
<artifactId>jaxb2-maven-plugin</artifactId>  
<version>2.5</version>  

我修改标签版本为:

<version>2.5.0</version>  

然后在eclipse中打开项目的上下文菜单,选择Maven >“更新项目…”,确保对话框中选中了“更新依赖项”,然后点击“确定”按钮。

在我的例子中,我在spring工具4中得到了这个错误消息

ArtifactTransferException: org.codehaus.plexus:plexus-interpolation:jar:1.26 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus-interpolation:jar:1.26 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org java.lang.reflect.InvocationTargetException

这是解决方案

步骤01 -首先关闭弹簧工具应用程序

步骤02 -进入路径C:\Users\User并删除。m2文件夹

步骤03 -现在去包探索和选择你的项目

第04步-现在右键单击您的项目,进入Maven,单击更新项目

如何卸载Spring Tool 4

步骤01 -单击帮助并转到关于Spring工具套件4

步骤02 -现在点击安装细节

步骤03 -在里面,你可以看到所有已安装的软件,只需按Ctrl + A选择所有,然后单击卸载