When I try and generate the Eclipse project files using mvn eclipse:eclipse
I get the following error:
Internal error in the plugin manager executing goal 'org.apache.maven.plugins:maven-eclipse-plugin:2.9-SNAPSHOT:eclipse': Unable to load the mojo 'org.apache.maven.plugins:maven-eclipse-plugin:2.9-SNAPSHOT:eclipse' in the plugin 'org .apache.maven.plugins:maven-eclipse-plugin'. A required class is missing: org/codehaus/plexus/resource/loader/ResourceNotFoundException
It appears that I'm using version 2.9-SNAPSHOT of the Maven Eclipse plugin. My guess is that there is a bug in this version of the plugin and if I use a stable release (instead of a snapshot), the problem will be resolved. Is there a way that I can change the version of this plugin I'm using, or is this problem unrelated to the version of the Eclipse plugin?
Either use the fully qualified name of the plugin to specify the version:
$ mvn org.apache.maven.plugins:maven-eclipse-plugin:2.8:eclipse
Or edit the ~/.m2/plugin-registry.xml
file (for advanced users, make a backup).
Or try the -npr,--no-plugin-registry
options to tell maven to not use ~/.m2/plugin-registry.xml
for plugin versions:
$ mvn -npr eclipse:eclipse
But I don't guarantee a successful result. See the Introduction to the Plugin Registry for more details.
Or remove the version 2.9-SNAPSHOT
from your local repository:
$ rm -rf ~/.m2/repository/org/apache/maven/plugins/maven-eclipse-plugin/2.9-SNAPSHOT
Unfortunately the problem still persists and the selected answer did not help me, as Maven always wanted to fetch the newest version available, which is the faulty 2.9-SNAPSHOT.
I had to manually specify the working version 2.8 in my POM, like so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
...
The solutions mentioned in the accepted answer does not seems to work. Using no plugin registry, it always tries to use the latest version, and re-download it you try to delete it.
I solved the problem by updating the file
.m2/repository/org/apache/maven/plugins/maven-eclipse-plugin/maven-metadata-central.xml
You're not supposed to edit this file, but if it was using the 2.9-SNAP instead of 2.9, it probably means that this file specified 2.9-SNAP at the latest instead of the 2.9
来源:https://stackoverflow.com/questions/3131285/generating-eclipse-project-files-with-maven