-
Notifications
You must be signed in to change notification settings - Fork 72
Eclipse
The Maven eclipse:eclipse
goal generates metadata that allows you to import and build the project in Eclipse.
First make sure you have Maven installed. From your command line run which mvn
. If installed and properly configured it should return something like /usr/local/bin/mvn
.
From the project root run mvn eclipse:eclipse
. If successful, this will generate two files: .project
and .classpath
. To import the project into Eclipse, select Import...
from the File
menu and navigate to the project root.
mvn eclipse:eclipse
is not compatible with m2e, Eclipse’s built-in Maven plug-in. mvn eclipse:eclipse
creates a static list of library dependencies in the .classpath
project metadata, while m2e manages the classpath dynamically, based on the dependencies declared in the POM.
Navigate your favorite text (or XML) editor to the project root and open the .project
and .classpath
files.
To .project
, add
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
</buildCommand>
to the buildSpec
element and
<nature>org.eclipse.m2e.core.maven2Nature</nature>
to the natures
element.
In .classpath
, remove all entries starting with M2_REPO
and add
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
See also M2Eclipse (m2e) Support for Maven Eclipse Plugin Projects.