Home > Java > Migrating from m2eclipse to m2e

Migrating from m2eclipse to m2e

Since Indigo, the Maven Ecliple plugin formerly known as m2eclipse became part of Eclipse release (at least in the pure Java release). The name of the plugin also changed from m2eclipse to m2e. This was not the sole change, however:

  • The number of tabs on the POM has shrinked drastically, and the features as well. This will probably be the subject of a later post since I feel quite cheated by the upgrade.
  • The POM configuration has been more integrated with Eclipse build (which can cause unwanted side-effects as I described in my last article).

More importantly, projects that began with m2eclipse can be built in Indigo but no contextual Maven menu is accessible on the project itself (though a contextual menu is available on the POM).

In order to migrate flawlessly and have our contextual menu back, some actions are necessary. They are gruesome because it involves updating by hand Eclipse configuration file.

Warning: at this point, you have the choice to stop reading. If you decide to continue and use the process described below, it’s at your own risk!

The Maven plugin recognizes a project as a Maven one based the .project Eclipse proprietary configuration file. To display it, go to the Project Explorer view, click on the scrolling menu at the top right and choose Customize View. You have to uncheck *.resources: along the .project file , you should see a .classpath file as well as a .settings folder.

  1. In the .project:
    • Replace org.maven.ide.eclipse.maven2Builder by org.eclipse.m2e.core.maven2Builder in the buildSpec section
    • Replace org.maven.ide.eclipse.maven2Nature by org.eclipse.m2e.core.maven2Nature in the natures section
  2. In the .classpath, replace org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER by org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER
  3. Finally, in the .settings folder, rename the org.maven.ide.eclipse.prefs file to org.eclipse.m2e.core.prefs. Contents should be left unchanged.

Now, the contextual menu should appear and work accordingly.

Remember, this is a big hack you should only use with the right parachute (at least a source control management system) since it will hurt you plenty if it fails. For me, it has always worked… yet.

email
Send to Kindle
Categories: Java Tags: , ,
  1. Olivier
    October 4th, 2011 at 10:16 | #1

    Personnaly, i’d suggest to forget old m2eclipse settings, which are very few (except the workspace resolution option).
    This is done by deleting .settings/org.maven.ide.eclipse.prefs before importing the project under m2e.
    Then all the maven menus appears correctly.

  2. Andreas
    October 21st, 2011 at 12:07 | #2

    Thanks! This “m2eclipse-> m2e”-tutorial was very helpful… :-)

  3. Enrique
    November 5th, 2011 at 00:21 | #3

    Thanks for the tutorial. Very simple and helpful. It works :)

  4. Javier Osuna
    April 19th, 2012 at 12:02 | #4

    At least useful info to solve my problems with Indigo! thanks!

  5. Gustavo
    January 2nd, 2014 at 19:48 | #5

    Works!!! Thanks!

  1. December 25th, 2011 at 14:54 | #1