Java – Non-resolvable parent POM in SpringBoot

javamavenpom.xmlspringspring-boot

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>

Best Answer

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

Related Topic