1

After getting a new laptop, I am facing this issue very frequently, the spring dependencies particulary spring boot is not getting downloaded, the message that I got was

[ERROR]   The project com.john:EmployeeH2Demo:1.0-SNAPSHOT (C:\Users\John\IdeaProjects\EmployeeH2Demo\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.john:EmployeeH2Demo:1.0-SNAPSHOT: org.springframework:spring-boot-starter-parent:pom:2.5
.2 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolutio
n is not reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at no local POM @ li
ne 6, column 13 -> [Help 2]

First I did not had settings.xml but it was not working then I checked the url https://repo.maven.apache.org/maven2 this url did not had spring-boot-starter-parent, and when I googled I could find spring-boot dependency in this repo http://www.mvnrepository.com, so I tried using that repo, resulting in the below settings.xml

Here is my settings.xml

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${user.home}/.m2/repository</localRepository>
<interactiveMode>true</interactiveMode>
<offline>false</offline>
<pluginGroups>
        <pluginGroup>org.apache.tomcat.maven</pluginGroup>
</pluginGroups>
<profiles>
    <profile>
        <repositories>
            <repository>
                <id>mvnrepository</id>
                <name>mvnrepository</name>
                <url>http://www.mvnrepository.com</url>
            </repository>
        </repositories>
    </profile>
</profiles>
<activeProfiles>
    <activeProfile>mvnrepository</activeProfile>
</activeProfiles>
</settings>

and here is the pom.xml for this project.

<?xml version="1.0" encoding="UTF-8"?>
<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>
    <parent>
        <groupId>org.springframework</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.2</version>
        <relativePath/>
    </parent>

    <groupId>com.john</groupId>
    <artifactId>EmployeeH2Demo</artifactId>
    <version>1.0-SNAPSHOT</version>
    <description>Demo Project for H2 in memory database using SpringBoot</description>
    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>>

But even after several attems to clean build the project, I am not able to do it.

After removing the settings.xml from the .m2 directory, still getting the following error.

$ mvn clean install -U
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/spring-boot-starter-parent/2.5.2/spring-boot-starter-parent-2.
5.2.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.bablo:EmployeeH2Demo:1.0-SNAPSHOT: Could not find artifact org.springframework:spring-boot-starter-pare
nt:pom:2.5.2 in central (https://repo.maven.apache.org/maven2) and 'parent.relativePath' points at no local POM @ line 6, column 13
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project com.john:EmployeeH2Demo:1.0-SNAPSHOT (C:\Users\bablo\IdeaProjects\EmployeeH2Demo\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.bablo:EmployeeH2Demo:1.0-SNAPSHOT: Could not find artifact org.springframework:spring-boo
t-starter-parent:pom:2.5.2 in central (https://repo.maven.apache.org/maven2) and 'parent.relativePath' points at no local POM @ line 6, column 13
 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

I am not behind a proxy, neither I am using a vpn or anything like that.

Also on checking on the url being hit by maven to download the spring-boot-starter-parent, that is this url,

https://repo.maven.apache.org/maven2/org/springframework/spring-boot-starter-parent/2.5.2/spring-boot-starter-parent-2. 5.2.pom

nothing is there at that location, can I not get any other url to be searched by maven, to download spring-boot-starter-parent dependency.

3
  • 1
    Remove the settings.xml completely. Apart from that http://www.mvnrepository.com is no usable Maven repository... Commented Jul 10, 2021 at 16:12
  • Removed it, but the error persists. Commented Jul 10, 2021 at 16:19
  • 1
    Clean your local cache. Delete your .m2 directory and recreate again Commented Jul 10, 2021 at 16:40

2 Answers 2

2

The <groupId> of the <parent> in your pom is incorrect. You have org.springframework. It should be org.springframework.boot.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I also figured it out, but before I could post, you have given the correct answer, thanking you and accepting your answer
1

Very trivial error, sorry guys but the issue was that I was not giving the correct group id org.springframework.boot, so the correct pom is.

<?xml version="1.0" encoding="UTF-8"?>
<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>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.2</version>
        <relativePath/>
    </parent>

    <groupId>com.john</groupId>
    <artifactId>EmployeeH2Demo</artifactId>
    <version>1.0-SNAPSHOT</version>
    <description>Demo Project for H2 in memory database using SpringBoot</description>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.