Kingamere
Kingamere

Reputation: 10176

Maven and Spring Boot - non resolvable parent pom - repo.spring.io (Unknown host)

I am trying to build my project but I get this:

Non-resolvable parent POM: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.3.0.M3 from/to spring-snapshots (http://repo.spring.io/snapshot): repo.spring.io and 'parent.relativePath' points at no local POM @ line 16, column 10: Unknown host repo.spring.io -> [Help 2]

Here is how I specify the parent of my pom.xml:

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

The is empty so that it forces maven to look for the parent in the remote repository. However, it says that repo.spring.io is an unknown host.

Here is how I define the repositories in my pom.xml:

<repositories>
    <repository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>spring-milestones</id>
        <url>http://repo.spring.io/milestone</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/snapshot</url>
    </pluginRepository>
    <pluginRepository>
        <id>spring-milestones</id>
        <url>http://repo.spring.io/milestone</url>
    </pluginRepository>
</pluginRepositories>

Any ideas?

Upvotes: 49

Views: 266635

Answers (18)

aAkash thorve
aAkash thorve

Reputation: 1

If a project is created by one user like c:/users/userA and he had build the project and after that second user like c:/users/userB logs in and try to run the maven test or install or maven update then he encounters a non-resolvable parent pom error solution is steps to be done by userB:

  1. Go to c:/users/userA/.m2/repository and copy "org" folder.
  2. Go to c:/users/userB/.m2/repository and rename "org" to "org_original".
  3. Paste org which is copied from c:/users/userA/.m2/repository in c:/users/userB/.m2/repository .
  4. right-click on project and maven force update in Spring Tool workspace. All dependencies are resolved.

Upvotes: 0

Tushar
Tushar

Reputation: 1104

This worked for me! Try navigating to the Maven tab and then click on install. After finishing, again try to resolve dependencies. enter image description here

Upvotes: 3

Bareet Singh
Bareet Singh

Reputation: 31

I was facing the same issue. The reason was the Internet connection. It was resolved when I changed ISP.

Upvotes: 0

Maarten Folkers
Maarten Folkers

Reputation: 101

After the error "Non-resolvable parent POM: Could not transfer artifact etc.", I found out that I indeed had to configure a proxy server.

However, in spite of restarts etc., the error only disappeared after doing: mvn dependency:purge-local-repository

Guess this has to do with re-resolving dependencies: Apache documentation about purging local repository dependencies

Upvotes: 1

Ritesh Kumar
Ritesh Kumar

Reputation: 157

Just right click on pom.xml > maven > update maven project > check the force update of Snapshots/Releases

Upvotes: 1

c.sankhala
c.sankhala

Reputation: 909

If all above stuffs not works. try this. If you are using IntelliJ. Check below setting: enter image description here

May be ~/.m2/settings.xml is restricting to connect to internet.

Upvotes: 4

peng jia
peng jia

Reputation: 11

Just a remind: I tried to work with idea and imported maven, and encountered the same problem, I have tried all the solutions and they didnt work. Finally, I found out it was because of the root access... I opened idea with administrator access and all things work just fine, hope you not as silly as i am...

Upvotes: 1

Vijayaraghavan T
Vijayaraghavan T

Reputation: 1

In the pom.xml (after loading effective pom.xml in eclipse), you may see it "http://repo.maven.apache.org/maven2" under central repository instead of "https://repo.maven.apache.org/maven2". Fix it

Upvotes: -1

Gaurav
Gaurav

Reputation: 68

If you are using docker service and you have switched to other network. You need to restart docker service.

service docker restart

This solved my problem in docker.

Upvotes: 0

Marcos Gon&#231;alves
Marcos Gon&#231;alves

Reputation: 11

As people already mentioned, it could be internet problems or proxy configuration.
I found this question when I was searching about the same problem. In my case, it was proxy configuration.
Answers posted here didn't solve my issue, because every link suggest a configuration that shows the username and passoword and I can't use it.
I was searching about it elsewere and I found a configuration to be made on settings.xml, I needed to make some changes. Here is the final code:

<profiles>
    <profile>
       <id>MavenRepository</id>
           <repositories>
            <repository>
                <id>central</id>
                <url>https://repo1.maven.org/maven2</url>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
                <releases>
                    <enabled>true</enabled>
                </releases>
            </repository>
        </repositories>
    </profile>
</profiles>

<activeProfiles>
    <activeProfile>MavenRepository</activeProfile>
</activeProfiles>

I hope be useful.

Upvotes: -1

Atul Jain
Atul Jain

Reputation: 1085

Downgrade your version

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

Build and undo the version, Build. 2.1.6.RELEASE to 1.3.3.RELEASE Build Undo 1.3.3 to 2.1.6 Build (in my case problem solved) It helped us.

Upvotes: -2

lgpasquale
lgpasquale

Reputation: 496

For anyone stumbling upon this question, I'll post the solution to a similar problem (same error message except for the uknown host part).

Since January 15, 2020 maven central no longer supports HTTP, in favour of HTTPS. Consequently, spring repositories switched to HTTPS as well

The solution is therefore to change the urls from http://repo.spring.io/milestone to https://repo.spring.io/milestone.

Upvotes: 22

siddagrl
siddagrl

Reputation: 371

In my case the problem was with the java version mismatch of pom.xml (java 1.8) and environment variables JAVA_HOME/JDK_HOME (java 1.7). After pointing environment variables JAVA_HOME & JDK_HOME to Java 1.8, the issue got resolved.

Upvotes: 5

arif abbas
arif abbas

Reputation: 341

The issue is with your project which is not able to complete maven build. Steps to follow :

  1. Right Click Application and RunAs maven install.
  2. If you get any error while reaching the repos online try giving the proxies in settings.xml under your .m2 directory.Check this link for setting proxies for maven build.
  3. Once done , try doing a Update Project by Right Click Project , Maven->Update Maven Project and select codebase and do check the Force Update of Snapshot/Release check box.

This will update your maven build and will surely remove your errors with pom.xml

Upvotes: 8

prachi shah
prachi shah

Reputation: 81

Project->maven->Update Project->tick all checkboxes expect offline and error is solved soon.

Upvotes: 7

David Caceres
David Caceres

Reputation: 71

Rigth button on your project -> Maven -> Update

Upvotes: 6

Panthro
Panthro

Reputation: 3600

If you're using docker-machine (docker on Windows or OSX).

Currently docker-machine has a bug that it loses internet connection if you switch between wifi networks or wifi and cable.

Make sure you restart your docker-machine

usually: docker-machine restart default

Upvotes: 1

dunni
dunni

Reputation: 44555

Obviously it's a problem with your internet connection. Check, if you can reach http://repo.spring.io with your browser. If yes, check if you need to configure a proxy server. If no, you should contact your internet provider.

Here is the documentation, how you configure a proxy server for Maven: https://maven.apache.org/guides/mini/guide-proxies.html

Upvotes: 36

Related Questions