Using the Maven archetypes for starting the projects is very convenient, but afterwards you probably want to use an IDE to edit the files. This page describes the steps necessary to use Eclipse for any Maven project.
Using Maven's eclipse plugin to generate project descriptors
Using mvn eclipse:eclipse, the necessary .classpath and .project files will be generated for Eclipse to be able to work with the project. To give you an example, if you run this command inside this tutorial project , you will get this output:
Configure M2_REPO classpath variable
The project descriptors generated refer to the local Maven repository using the M2_REPO classpath variable. You need to configure this inside Eclipse.
- Bring up the Preferences dialog (Top menu: Window ⇒ Preferences...)
- Navigate to the classpath variable preference page (Java ⇒ Build Path ⇒ Classpath Variables) and click the New... button
- Add a variable with the name M2_REPO and the path pointing to your local Maven repository location
Unable to render embedded object: File (configure-m2_repo-01.png) not found.
Import the project(s) in Eclipse
Now it's time to actually import the projects into Eclipse by using the Import wizard. You can find the wizard in the top menu (File ⇒ Import...) or in the navigation pane's context menu.
- Select General ⇒ Existing projects into Workspace as the import source
- Select your project's root directory for the wizard to show all Eclipse projects at that location. Be sure NOT to select the 'Copy projects into workspace' checkbox and hit the Finish button.
... and start using Eclipse to edit your Maven project files
Further reading