简体   繁体   中英

Spring STS spring boot project maven pom error

Hello I am trying to learn spring boot. I have installed Spring STS Spring Tool Suite

Version: 3.6.4.RELEASE Build Id: 201503100339 Platform: Eclipse Luna SR1 (4.4.2) Java 1.7.

I am trying to create a spring starter project. After I do it with the sts I get the project generated but the Maven pom contains errors. It always says : Project build error:

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.

The POM is automatically generated when I create a spring starter project and it always generates that error. I understand that there is something wrong the the spring files but I don't know how to solve that problem. Can someone here give me please an advice how to solve this. Thanks.

Best regeards.

Khelvan

I had the same problem, using NetBeans 8.1, Maven 3.0.1, and Spring MVC versions 4.0.1 and 4.2.5.

The first solution I found on the web was to update Maven to version 3.3.9, which did not solve my problem. However, with more search I found a useful link . There it explains for including Maven's "bill of materials" (BOM) dependency you can use:

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

Before I was missing <type> and <scope> tags in the auto-generated code. After adding them the problem was solved.

Since I am not sure if updating Maven also helped or not, you might also try that.

Check the version of the bom you are using. When I changed mine to 4.3.5.RELEASE, the error went away

I was getting the same issue while importing maven project from spring initialzr.

Spring Tool Suite 4 Version: 4.1.0.RELEASE

Just add below lines in pom.xml file:-

<properties>
        <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>

Happy Coding ;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM