问题
Created an project in Spring Tool Suite using Spring Starter Project and i get an error in pom.xml as below
:Project build error: Non-resolvable parent POM for
com.example:demo:0.0.1-SNAPSHOT: Failure to transfer
org.springframework.boot:spring-boot-starter-parent:pom:1.4.0.RELEASE
from https://repo.maven.apache.org/maven2
was cached in the local repository, resolution will not be reattempted
until the update interval of central has elapsed or updates are
forced. Original error: Could not transfer artifact
org.springframework.boot:spring-boot-starter-parent:pom:1.4.0.RELEASE from/to
central (https://repo.maven.apache.org/maven2):
repo.maven.apache.org and 'parent.relativePath' points at no local POM.
Please help me out in resolving it
回答1:
Right click on your project name -> select "Run As" -> "Maven Build" then choose your Base Directory and in Goals write "spring-boot:run -U". After that click on Run.
Give it a little time to download all neccessary dependencies and will build successfully.
回答2:
See my comments above. Yesterday I was able to repeat the problem scenario several times:
After creating a new project with the SPRING INITIALIZR tool the External Libraries folder was empty - no Maven. Looking at the top of the pom file project was red squiggly underlined with the mouse-over message "Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:1.4.0.RELEASE". I right clicked on project, selected Maven from the dropdown, then selected "reimport". The re-import failed - repeatedly. The external libraries folder remained empty. On a couple of occasions the event log message displayed the Failure to transfer ... message. Other times nothing was logged.
Today I decided to give it another try. This time I got the same "Failure to transfer ... " message but the external libraries were added, presumably from the local repository. The project now builds successfully.
Only advice I can offer is the old "If at first you don't succeed try try again"
回答3:
i did exactly what Faisal said and, after download all dependencies, the build occurs
after this (even with the project runing) the eclipse error marker continues on the project folder, so, i just right-click > Maven > Update Project... > OK and all was fixed
thanks!
来源:https://stackoverflow.com/questions/38751782/error-in-project-creation-in-spring-tool-suite-using-spring-starter-project