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

其他回答

我在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

对我来说,我只是在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中: 右键单击项目->Maven->更新项目->选中“快照/版本强制更新”复选框。单击OK。