Chanaka De Silva Chanaka De Silva - 3 months ago 9x
Java Question

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


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

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