Friday, June 15, 2012

Convert Maven Project To Eclipse Project

Most Eclipse user using m2e  plugin to handle Maven projects in Eclipse, while Maven provide maven-eclipse-plugin to convert Maven project to Eclipse by running command line: mvn eclipse:eclipse.
There is a problem; m2e doesn't like maven-eclipse-plugin results and occasionally produce an error.
So my suggestion, don't use "mvn eclipse:eclipse" cli to convert Maven project into Eclipse's.

Import Maven Project To Eclipse

M2e provide a wizard for this purpose. This wizard can be found in the Import menu: File->Import.
  1. Open menu: File->Import
  2. Select wizard: Maven->Existing Maven Project
  3. On the "Import Maven Projects" wizard, select root directory. Root directory is a folder contain Maven projects. (Maven project is a folder contain pom file and other folder like src...etc). Please don't be confused with this two different things.
  4. After root directory is selected, the existing Maven project will be displayed.
  5. Click "Finish" button to start importing process, then you will get the project is imported on you eclipse workspace.

Resolving Error

When we use maven-eclipse-plugin result some error may occur since m2e doesn't compatible with maven-eclipse-plugin.
  1. "Unsupported IClasspathEntry" error. The detail error can be founded here. Solution: either you have to reimport the project using m2e importing wizard or just delete the .classpath file in the project folder then run m2e "update project ..." wizard in the context menu.

About m2e (and formerly m2eclipse)

  1. Changing from m2eclipse to m2e (Eclipse 3.7 - Indigo)





No comments:

Post a Comment