问题
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?
回答1:
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
回答2:
The issue is with your project which is not able to complete maven build. Steps to follow :
- Right Click Application and RunAs maven install.
- 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.
- 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
回答3:
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.
回答4:
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
回答5:
Rigth button on your project -> Maven -> Update
回答6:
Project->maven->Update Project->tick all checkboxes expect offline and error is solved soon.
回答7:
it's a problem with your internet connection. Might be there are some restriction thats why you are unable to reach http://repo.spring.io with your browser.
来源:https://stackoverflow.com/questions/32125025/maven-and-spring-boot-non-resolvable-parent-pom-repo-spring-io-unknown-host