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

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


当前回答

创建一个文件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的工作上。

其他回答

尝试执行

mvn -U clean

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

对我来说,我只是在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>

我在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建议的那样)解决了这个问题。

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

将依赖项复制到pom。 < >的依赖 < groupId > org.apache.maven < / groupId > < artifactId > maven-archiver < / artifactId > <版本> 2.5版本> < / < / >的依赖 右击您的项目 选择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