0

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

Chanaka De Silva
  • 406
  • 1
  • 7
  • 21
  • If you have maven (mvn) configure in your path, you could open a terminal at your project root and type 'mvn clean install -U'. This will build the project while forcing the update of dependencies – alexbt Jul 13 '16 at 04:05
  • see http://stackoverflow.com/questions/4701532/force-maven-update – alexbt Jul 13 '16 at 04:05
  • Or, in TST, right click on your project -> maven -> Update project -> Force Update of Snapshots/Releases – alexbt Jul 13 '16 at 04:06

1 Answers1

1

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

alexbt
  • 16,415
  • 6
  • 78
  • 87
  • It's called 'STS' not 'TST' (Spring Tool Suite). – Kris Jul 13 '16 at 22:36
  • Note that from experience I know that if you use (1) this can very much confuse m2e (Eclipse maven tools). I'm not really sure why that is, but I think probably because m2e executes code from maven plugins in the IDE process as part of project builds. Deleting these jars after m2e became aware of their existence makes M2E behave strangely. So best to do this only when the IDE is not running, or at least restart your IDE after you do it. (It doesn't do 'real' damage, a IDE restart will fix it :-) – Kris Jul 13 '16 at 22:40
  • Thanks @kris for your comments. I updated the STS acronym! – alexbt Jul 13 '16 at 22:45