6

I am getting below error in the first line of my pom.xml

Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 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.plugins:maven-surefire-plugin:pom:2.12.4 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org
eebbesen
  • 5,070
  • 8
  • 48
  • 70
Deepesh Uniyal
  • 923
  • 3
  • 20
  • 44
  • Have you tried forcing an update? Look at [this question](http://stackoverflow.com/questions/4856307/when-maven-says-resolution-will-not-be-reattempted-until-the-update-interval-of). – eebbesen Mar 03 '14 at 18:08
  • HI, yes I have tried to update it, but now how I can fix it.? – Deepesh Uniyal Mar 03 '14 at 18:18
  • I have found that forcing the update works for me in this situation, as long as the artifact Maven is looking for exists in the location in which it is looking for it. For me, when the message says `resolution will not be reattempted until the update interval of central has elapsed or updates are forced`, that's when I force the update to remove the message. As mentioned in the linked question, you can use settings in Eclipse to force the update, or you can use the `-U` flag from the command line to force the update. – eebbesen Mar 03 '14 at 20:36

1 Answers1

17
  1. Goto the directory {Home}/.m2/repository/org/apache.
  2. Delete the maven folder.
  3. Right click on your Maven project in Eclipse and select Maven -> Update Project...
  4. In the appeared dialog, select the Force Update of Snapshots/Releases and click OK

Make sure that, you do not have any proxy related problems when updating the project again.

Gobinath
  • 904
  • 1
  • 15
  • 23
  • Thanks so much for this. It really did the trick. I've wasted hours trying to figure out why eclipse just said there was an error in my pom.xml with the description "unknown" – Jocken Jan 24 '18 at 14:43
  • @Gobinath why we should remove that folder, please? I have the problem but I can't figure out how this problem is generated – Thamer Feb 09 '19 at 23:54
  • 1
    Hi @Thamerbelfkih, It happens if you have any proxy issues or any other (mostly network related) issues which caused to partial or corrupted files downloaded into the local repository `.m2`. Until you remove those incomplete folders of the corrupted library, Maven will assume that those libraries are already downloaded and will not redownload them again. Deleting the relevant folder forces Maven to redownload the library. – Gobinath Feb 10 '19 at 12:15