Non-resolvable parent POM in SpringBoot

32,232

Solution 1

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.

Solution 2

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

Solution 3

From where revision will be replaced ?

Modify pom.xml by specifying any version like below.

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.0.RELEASE</version>
</parent>

Solution 4

Here :

<parent>
  <!-- Your own application should inherit from spring-boot-starter-parent -->
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>${revision}</version>
</parent>

${revision} will be interpolated by Maven (that is translated) only if Maven finds a variable with the revision name.
But revision is not a Maven built in variables. While variables as ${project.version} and ${project.artifactId} are.

So in your case, you have to declare or pass the variable explicitly if you want to use it.

For example it could work by adding it :

<properties>
  <revision>1.4.2 RELEASE</revision>
</properties>

Or by running maven such as : mvn package -Drevision="1.4.2 RELEASE"

You can find more information here.

Note that a revision property appears to have a too broad meaning and doesn't help to understand the property meaning.
A more precise name such as ${spring-boot-version} would make more sense.

Solution 5

Replace

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.2 RELEASE</version>
</parent>

with

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.2.RELEASE</version>
   <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
Share:
32,232

Related videos on Youtube

Kshitiz Sharma
Author by

Kshitiz Sharma

Hello everyone, I am a computer science fresh grad doing my internship from Cognizant on Hyperledger Fabric Blockchain. I have been an active competitive programmer in the past and data structure and algorithm enthusiast. Currently, I am learning basics of web development in my spare time along with fundamentals of the blockchain.

Updated on April 15, 2021

Comments

  • Kshitiz Sharma
    Kshitiz Sharma about 3 years

    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>
    
  • Jan Černý
    Jan Černý about 4 years
    Please add explanation