Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating Eclipse project files with Maven

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?

like image 871
Dónal Avatar asked Jun 28 '10 09:06

Dónal


People also ask

How do I create a Maven project in Eclipse?

Create a new Maven project in Eclipse. From the File menu, choose New, and then choose Project. In the New Project window, choose Maven Project. In the New Maven Project window, choose Create a simple project, and leave other default selections.

Can you use Maven with Eclipse?

Using Maven with the Eclipse IDEThe Eclipse IDE provides support for the Maven build. This support is developed in the M2Eclipse project. It provides an editor for modifying the pom file and downloads dependencies if required. It also manages the classpath of the projects in the IDE.

Why do we use Maven project in Eclipse?

Maven provides you a way to centralize dependency libraries across the enterprise. It lets you automate your build process (most likely in conjunction with a CI server like hudson, cruise control, etc). It lets you automate your unit testing. Maven makes the packaging of app very easy to do.

What is Maven Eclipse Eclipse?

The Maven Eclipse Plugin is used to generate Eclipse IDE files (*. classpath, *. project, *. wtpmodules and the . settings folder) for use with a project.


2 Answers

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
like image 84
Pascal Thivent Avatar answered Oct 05 '22 13:10

Pascal Thivent


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>
...
like image 2
Gregor Avatar answered Oct 05 '22 12:10

Gregor