Eclipse Properties Vincent Massol dIon Gillard
PropertyOptional?Description
maven.eclipse.workspace Yes Location of the Eclipse workspace that holds your configuration and source.

On Windows, this will be the workspace directory under your eclipse installation. For example, if you installed eclipse into c:\eclipse, the workspace is c:\eclipse\workspace.

If this parameter is specified, the external-tools goal will use it as the destination to copy the generated file.

maven.eclipse.junit Yes (default=3.8.1) The version of JUnit you want added to your project. If this property is set to none then JUnit will not be added to your build classpath.
maven.eclipse.output.dir Yes (default=${maven.build.dest) The directory to which Eclipse should output its classes. By default this is the same directory as Maven generates its code however this can be changed so that maven clean does not interfere with Eclipse's build.
maven.eclipse.test.output.dir Yes (default=${maven.test.dest} defined in test plugin) The directory to which Eclipse should output its test classes.
maven.eclipse.classpath.include Yes Comma delimited list of additional directories to include in the classpath, like src/conf.
maven.eclipse.buildcommands Yes Comma delimited list of additional build commands to include in the project description file.
maven.eclipse.projectnatures Yes Comma delimited list of additional project natures to include in the project description file. These natures will be added after the java nature.
maven.gen.src Yes (default=${maven.build.dir}/generated-sources) The directory that generated source code is placed. Maven will select any directories under this as source code. This prevents the generated source from being removed whenever Eclipse does a clean build, and allows the generated code to be clearly in the build directory.

Note that you will need to defined a MAVEN_REPO Java Classpath variable in Eclipse. This is done by selecting the Window menu, then Preferences. In the dialog box, select the Java node and then Classpath Variables. Create a new variable named MAVEN_REPO that points to your local Maven repository.

The dependencies defined in the POM need not to be jars strictly. They can be projects in the eclipse workspace. If a dependency is an eclipse project a property needs to be added to that dependency to indicate so.

group artifact version true ]]>

This indicates that the dependency is another project in the workspace. Note that the name of the referenced project is the artifactId.

The inverse also works. If you have included extra jars that shouldn't be in the eclipse classpath then you can set eclipse.dependency=false

When Eclipse is not generating source code for you there is a conflict between Maven generating the source code and then Eclipse treating it as compiled code. Typically when generating code using Maven the code ends up in the target/classes directory. This is fine as long as Maven is doing the build. However, if Eclipse is then setup to do the build, when Eclipse performs a clean build all the generated code in target/classes will be removed.

The alternatives typically are to place the generated code in the /src/java directory and allow Maven and Eclipse to treat it the same. However, this leads to a tendency to check generated code into source control, which typically is not appropriate for generated code. Alternatively, it can be placed in some sort of /src/generated or target/generated directory. In Maven2, generated code lives in target/generated-sources, in a manner similiar to generated xdoc's live in target/generated-xdocs. Within the target/generated-sources would be each type of generated code.

For example, if you used the XDoclet Plugin for Maven to generate Hibernate mapping files, they would be placed in /target/generated-sources/xdoclet/. While, if you used the Hibernate Plugin for Maven to generate the SQL scripts for generating a database then that would be placed in /target/generated-sources/schema/.
Settings in project.properties: maven.xdoclet.hibernatedoclet.destDir=${maven.build.dir}/generated-sources/xdoclet maven.hibernate.output.dir=${maven.build.dir}/generated-sources/schema