Spring STS春季启动项目maven pom错误

时间:2015-04-21 19:18:51

标签: spring maven project pom.xml

您好我正在尝试学习春季靴子。我已经安装了Spring STS Spring Tool Suite

版本:3.6.4.RELEASE Build Id:201503100339 平台:Eclipse Luna SR1(4.4.2) Java 1.7。

我正在尝试创建一个弹簧启动项目。在我使用sts之后,我得到了项目生成但是Maven pom包含错误。 它总是说:项目构建错误:

Project build error: Non-resolvable import POM: Failure to transfer org.springframework:spring-framework-bom:pom:4.1.6.RELEASE from  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.springframework:spring-framework-bom:pom:4.1.6.RELEASE from/to central  repo.maven.apache.org/maven2): The operation was cancelled.

Failure to transfer org.springframework:spring-framework-bom:pom:4.1.6.RELEASE from //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.springframework:spring-framework-bom:pom:4.1.6.RELEASE from/to central  repo.maven.apache.org/maven2): The operation was cancelled.

Project build error: Non-resolvable import POM: Failure to transfer org.springframework.security:spring-security-bom:pom:3.2.7.RELEASE from  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.springframework.security:spring-security-bom:pom:3.2.7.RELEASE from/to central ( repo.maven.apache.org/maven2): The operation was cancelled.

创建弹簧启动项目时会自动生成POM,它总是会生成错误。 我知道spring文件有问题,但我不知道如何解决这个问题。 有人可以给我一个如何解决这个问题的建议。 感谢。

最好的遗产。

Khelvan

3 个答案:

答案 0 :(得分:1)

从spring initialzr导入maven项目时遇到了同样的问题。

Spring Tool Suite 4版本:4.1.0.RELEASE

只需在pom.xml文件中添加以下行:-

from (filename) import (functionname)

快乐编码;

答案 1 :(得分:0)

我遇到了同样的问题,使用NetBeans 8.1,Maven 3.0.1和Spring MVC版本4.0.1和4.2.5。

我在网上找到的第一个解决方案是将Maven更新到版本3.3.9,但这并没有解决我的问题。但是,通过更多搜索,我发现了一个有用的link。在那里,它解释了包括Maven的“物料清单”(BOM)依赖关系,您可以使用:

<dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-framework-bom</artifactId>
        <version>4.2.5.RELEASE</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
</dependencies>

在我自动生成的代码中缺少<type><scope>标记之前。添加后,问题就解决了。

由于我不确定更新Maven是否也有帮助,您也可以尝试。

答案 2 :(得分:0)

检查您正在使用的炸弹版本。当我把我改为4.3.5.RELEASE时,错误就消失了