Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-resolvable parent POM in SpringBoot

I am trying to setup a Maven project for a Spring Boot application but while trying to save the pom.xml file I am getting this following issue:


Project build error: Non-resolvable parent POM for
io.javabrains.springbootquickstart:course-api:0.0.1-SNAPSHOT: Could not find artifact
org.springframework.boot:spring-boot-starter-parent:pom:${revision} in central (https:// repo.maven.apache.org/maven2) and 'parent.relativePath' points at wrong local POM

Here is my pom.xml file:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd">


  <modelVersion>4.0.0</modelVersion>
  <groupId>io.javabrains.springbootquickstart</groupId>
  <artifactId>course-api</artifactId>
 <version>0.0.1-SNAPSHOT</version>
 <name>Java Api course</name>


 <parent>
    <!-- Your own application should inherit from spring-boot-starter-parent -->
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.2 RELEASE</version>
  </parent>



 <dependencies>
   <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
   </dependency>
 </dependencies>
</project>
like image 393
Kshitiz Sharma Avatar asked Aug 03 '18 12:08

Kshitiz Sharma


2 Answers

This may be because of spring initializer created project pom file like this

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.5.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent> 

However, sts is compatible with version "2.0.4.RELEASE", just make this change

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent> 

further Maven -> Update Project

like image 128
Niraj Jha Avatar answered Sep 29 '22 00:09

Niraj Jha


Solved the issue. There was a little mistake. It should be 1.4.2.RELEASE instead of 1.4.2 RELEASE. There should not be space between RELEASE and 2. This little dot was causing the issue.

like image 44
Kshitiz Sharma Avatar answered Sep 28 '22 22:09

Kshitiz Sharma