Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring boot project not resolving dependencies - Failed to collect dependencies at org.springframework.boot:spring-boot-starter-web:jar:2.1.1.RELEASE

I was having a problem with setting up a spring demo project and did not easily find a solution online. Below lays out the details and I found a way to make it work (I'll add as an answer) for me and maybe it'll help someone else.

I am following the guide for building REST services with spring: https://spring.io/guides/tutorials/bookmarks/

In the guide, it says to go to https://start.spring.io/ and select the following: Web, JPA, H2, and Lombok.

I downloaded, upnzipped, and imported it into my Spring Tool Suite in Eclipse. Right away it can be seen that the project has issues so I right-click the project -> Maven -> Update Project... This did not resolve so next I did was:

Right-click project -> Run As -> Maven install

This results with BUILD FAILURE:

Failed to execute goal on project restDemo: Could not resolve dependencies for project com.example:restDemo:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at org.springframework.boot:spring-boot-starter-web:jar:2.1.1.RELEASE -> org.hibernate.validator:hibernate-validator:jar:6.0.13.Final: Failed to read artifact descriptor for org.hibernate.validator:hibernate-validator:jar:6.0.13.Final: Could not transfer artifact org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.3 from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]

I am behind a corporate firewall and I figured it had something to do with not being able to get all the dependencies.

like image 959
Chuck L Avatar asked Nov 30 '18 22:11

Chuck L


1 Answers

I added this to my pom.xml (note url uses http instead of https):

<repositories>
    <repository>
        <id>spring-releases</id>
        <url>http://repo.spring.io/libs-release</url>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>spring-releases</id>
        <url>http://repo.spring.io/libs-release</url>
    </pluginRepository>
</pluginRepositories>

Ultimately, I put that in my settings.xml file (found in C:\Users\user\.m2 directory) so that I don't have to add this to all my project pom.xml files.

like image 94
Chuck L Avatar answered Nov 09 '22 04:11

Chuck L