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

17

47

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?

Tanika answered 20/8, 2015 at 17:50 Comment(0)
D
36

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

Delisadelisle answered 20/8, 2015 at 18:15 Comment(4)
I assumed I had internet connection from the RDP, but I checked and I don't. thanksTanika
In addition to this answer, I also had to add proxy information to my Intellij settingsAmateur
I was using company proxy network, hence the issue. When i tried from home network(outside company) it worked fineTriphthong
The repo requires HTTPS now: repo.spring.ioAulea
I
22

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.

Igorot answered 17/1, 2020 at 8:55 Comment(2)
How to change url from http to https or where to change itConsanguinity
please provide steps on how to change thatEdwyna
D
8

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

Domineering answered 11/11, 2017 at 9:3 Comment(0)
I
7

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

Isaiah answered 25/5, 2017 at 10:46 Comment(0)
R
6

Rigth button on your project -> Maven -> Update

Rabush answered 27/4, 2017 at 9:12 Comment(0)
R
5

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.

Rundle answered 17/6, 2019 at 18:34 Comment(0)
H
4

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.

Homogenous answered 8/8, 2020 at 8:48 Comment(0)
U
1

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

Undershrub answered 19/1, 2016 at 12:32 Comment(0)
C
1

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...

Corene answered 26/7, 2020 at 21:49 Comment(0)
F
1

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

Flog answered 10/7, 2021 at 22:23 Comment(0)
F
1

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

Filiation answered 1/9, 2021 at 16:32 Comment(0)
C
1

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

Cralg answered 19/2, 2022 at 18:7 Comment(0)
S
0

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.

Sedillo answered 27/4, 2020 at 8:14 Comment(0)
S
0

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

Spates answered 18/10, 2021 at 14:28 Comment(0)
R
-1

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.

Rollet answered 3/4, 2020 at 13:30 Comment(0)
G
-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

Gusset answered 15/6, 2020 at 10:23 Comment(1)
From all that I see, the apache maven repo is not included in the repo list...Finny
S
-2

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.

Stereograph answered 24/2, 2020 at 13:48 Comment(1)
Your advice is to downgrade the version because of a protocol problem?Finny

© 2022 - 2024 — McMap. All rights reserved.