Java – Maven 2- Could not calculate build plan

eclipsejavamavenmaven-2

I set up Maven 2 on my laptop. The reason why I am still using Maven 2 is that Maven, somehow, doesn't work because of the proxy in my company.

The working environment:
Eclipse Helio Service Release 2
Maven 2.2.1
Windows 7

The error message:

Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'StrutsExample'.
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5

I thought it couldn't find the 2.5 jar so I downloaded it and added it into the local repository with the corresponding pom file manually, but it still can't work…

Any suggestion? Thanks in advance…

Best Answer

My working solution:

  • Close Eclipse
  • Go to c:\Users\*yourUser*\.m2\repository directory
  • remove all the files called m2e-lastUpdated.properties present on all subdirectories
  • Restart eclipse, refresh and Update Maven Projects

My exact error was:

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:2.4

Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-jar-plugin:pom:2.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.