Thursday, June 02, 2011

Error getting POM for org.apache.maven.plugins:maven-eclipse-plugin

From time to time I need to get back to this error
Reason: Error getting POM for 'org.apache.maven.plugins:maven-eclipse-plugin' from the repository: Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.
  org.apache.maven.plugins:maven-eclipse-plugin:pom:2.9-SNAPSHOT

As it happens with other maven dependencies their pom.xml file gets somehow modified and the plugin does not work as expected anymore.

The solution here is to navigate to your local repository, delete the dependency and try to download it again. If it still fails (clearly a pom.xml that has not been corrected) then you need to edit the metadata file. In my case:
/Users/nestor/.m2/repository/org/apache/maven/plugins/maven-eclipse-plugin/maven-metadata-central.xml 

You will notice the "latest node", for example:
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-eclipse-plugin</artifactId>
  <versioning>
    <latest>2.9-SNAPSHOT</latest>
    <release>2.8</release>
    <versions>
      <version>2.0-beta-1</version>
      <version>2.0-beta-2</version>
      <version>2.0</version>
      <version>2.1</version>
      <version>2.2</version>
      <version>2.3</version>
      <version>2.4</version>
      <version>2.5</version>
      <version>2.5.1</version>
      <version>2.5.2-SNAPSHOT</version>
      <version>2.6-SNAPSHOT</version>
      <version>2.6</version>
      <version>2.6.1-SNAPSHOT</version>
      <version>2.7-SNAPSHOT</version>
      <version>2.7</version>
      <version>2.8-SNAPSHOT</version>
      <version>2.8</version>
      <version>2.9-SNAPSHOT</version>
    </versions>
    <lastUpdated>20101028062425</lastUpdated>
  </versioning>
</metadata>

Just remove the "latest" node or edit it to reflect the version you want to use (probably a previous stable version) and problem solved

5 comments:

lucky said...

Thanks. Now it is working.

anonymous said...

You could also try mvn parameter -U
e.g.
mvn -U eclipse:eclipse

Jonathan said...

This article helped me - thanks.

Andre Kurniawan said...

This post helped me, Thank you .. :)

Unknown said...

Thanks. This worked for me

Followers