Kshitiz Sharma
Kshitiz Sharma

Reputation: 792

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>

Upvotes: 13

Views: 58322

Answers (7)

Anurag Litoriya
Anurag Litoriya

Reputation: 1

For me, actually AntiVirus was working in my system. So, I have disabled that for an hour and changed my version to 2.0.4.RELEASE and it works for me.

Upvotes: 0

nandini
nandini

Reputation: 11

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>

Upvotes: 1

lilalinux
lilalinux

Reputation: 3031

Check your Proxy Settings. In case you are working with a company PC that already has Proxys configured for browsers but not yet for your IDE or maven, you could probably enter the same information as for your browsers. You can find them e.g. by opening the network settings of your browser -> LAN Settings and then download the proxy.pac file from the address given in the input field. That file is human readable.

After that, you might still need to handle SSL errors by either

Upvotes: 0

Niraj Jha
Niraj Jha

Reputation: 605

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

Upvotes: 22

davidxxx
davidxxx

Reputation: 131496

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.

Upvotes: 0

Kshitiz Sharma
Kshitiz Sharma

Reputation: 792

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.

Upvotes: 8

Alien
Alien

Reputation: 15908

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>

Upvotes: 4

Related Questions