Thursday, May 28, 2015

Little trick on handling Maven failed to transfer error...

Transfer error again...
This is so frustrating every time I receive this error: Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from http://maven.repository.redhat.com/techpreview/all was cached in the local repository, resolution will not be reattempted until the update interval of jboss-ga-plugin-repository 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 jboss-ga-plugin-repository (http://maven.repository.redhat.com/techpreview/all): The operation was cancelled.
I have seen this error for so many times, and usually my action plan was:
  1. Refresh and clean the project.
  2. Force update Maven dependencies to the project.
And usually the result were still the same. There is a little nice trick could be done for this error, I got this trick from my senior:
  1. Open command prompt.
  2. Change directory to .m2 repository.
  3. Fire this command for /r %i in (*.lastUpdated) do del %i and wait until it complete.
  4. Force update Maven dependencies to the project.
This should cure the problem.

No comments: