Reputation: 10176
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
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:
c:/users/userA/.m2/repository
and copy "org" folder.c:/users/userB/.m2/repository
and rename "org" to "org_original".c:/users/userA/.m2/repository
in c:/users/userB/.m2/repository
.Upvotes: 0
Reputation: 1104
This worked for me!
Try navigating to the Maven tab and then click on install.
After finishing, again try to resolve dependencies.
Upvotes: 3
Reputation: 31
I was facing the same issue. The reason was the Internet connection. It was resolved when I changed ISP.
Upvotes: 0
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
Reputation: 157
Just right click on pom.xml > maven > update maven project > check the force update of Snapshots/Releases
Upvotes: 1
Reputation: 909
If all above stuffs not works. try this.
If you are using IntelliJ. Check below setting:
May be ~/.m2/settings.xml
is restricting to connect to internet.
Upvotes: 4
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
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
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
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
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
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
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
Reputation: 341
The issue is with your project which is not able to complete maven build. Steps to follow :
This will update your maven build and will surely remove your errors with pom.xml
Upvotes: 8
Reputation: 81
Project->maven->Update Project->tick all checkboxes expect offline and error is solved soon.
Upvotes: 7
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
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