简体   繁体   中英

Maven build error when downloading packages using pom.xml

I have following web project. It's a Spring and Hibernate project and i cloned it. https://github.com/thenewcircle/spring-hibernate-20120924 . But now there's an error in the pom.xml file. It says following message.

Failure to transfer org.apache.maven:maven-plugin-api:pom:2.0.6 from http://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.apache.maven:maven-plugin-api:pom:2.0.6 from/to central ( http://repo.maven.apache.org/maven2 ): The operation was cancelled.

And I tried chaging the version mumber too. But didn't work. And I'm using Spring Tool Suite 3.6.4 and Java 8. And actually i'm new to Spring and Hibernate. This is the pom.xml file i'm using.

https://github.com/thenewcircle/spring-hibernate-20120924/blob/master/pom.xml

There are several ways to fix this:

(1) Remove your local repository

You can just delete your local repository. Go into your $home/.m2 and manually delete the folder repository . Just know that doing so will remove all dependencies cached locally, so the next build of all your applications will take a longer time (to download all dependencies again). I put this one first, because I believe it is the most reliable. When all hell breaks loose, delete your repository.

(2) Command line - Build with force update dependencies

You may rebuild the project while forcing the update of dependencies. Open a terminal, change to your project's root folder and type:

mvn clean install -U

(3) IDE - Update project with force update dependencies

From your IDE you can update your project's configuration while forcing the update dependencies. In Eclipse/STS, do:

Right click on your project -> Maven -> Update project -> check 'Force update...' -> OK

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM