maven-plugins/eclipse/xdocs/properties.xml
2004-07-04 16:20:28 +00:00

178 lines
7.2 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Eclipse Properties</title>
<author email="vmassol@octo.com">Vincent Massol</author>
<author email="dion@apache.org">dIon Gillard</author>
</properties>
<body>
<section name="Eclipse Settings">
<table>
<tr><th>Property</th><th>Optional?</th><th>Description</th></tr>
<tr>
<td>maven.eclipse.workspace</td>
<td>Yes</td>
<td>
Location of the <a href="http://www.eclipse.org">Eclipse</a>
workspace that holds your configuration and source.
<p>
On Windows, this will be the <code>workspace</code> directory
under your eclipse installation. For example, if you installed
eclipse into <code>c:\eclipse</code>, the workspace is
<code>c:\eclipse\workspace</code>.
</p>
<p>
If this parameter is specified, the <a href="goals.html#eclipse:external-tools">
external-tools</a> goal will use it as the destination to copy the generated file.
</p>
</td>
</tr>
<tr>
<td>maven.eclipse.junit</td>
<td>Yes (default=3.8.1)</td>
<td>
The version of JUnit you want added to your project. If this
property is set to <code>none</code> then JUnit will not be added to your
build classpath.
</td>
</tr>
<tr>
<td>maven.eclipse.output.dir</td>
<td>Yes (default=${maven.build.dest)</td>
<td>
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 <code>maven clean</code>
does not interfere with Eclipse's build.
</td>
</tr>
<tr>
<td>maven.eclipse.test.output.dir</td>
<td>Yes (default=${maven.test.dest} defined in test plugin)</td>
<td>
The directory to which Eclipse should output its test classes.
</td>
</tr>
<tr>
<td>maven.eclipse.classpath.include</td>
<td>Yes</td>
<td>
Comma delimited list of additional directories to include in
the classpath, like <code>src/conf</code>.
</td>
</tr>
<tr>
<td>maven.eclipse.buildcommands</td>
<td>Yes</td>
<td>
Comma delimited list of additional build commands
to include in the project description file.
</td>
</tr>
<tr>
<td>maven.eclipse.projectnatures</td>
<td>Yes</td>
<td>
Comma delimited list of additional project natures
to include in the project description file. These natures
will be added after the java nature.
</td>
</tr>
<tr>
<td>maven.gen.src</td>
<td>Yes (default=${maven.build.dir}/generated-sources)</td>
<td>
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.
</td>
</tr>
</table>
<p>
Note that you will need to defined a <code>MAVEN_REPO</code> 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
<code>MAVEN_REPO</code> that points to your local Maven repository.
</p>
</section>
<section name="Defining dependencies as eclipse projects">
<p>
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.
</p>
<source><![CDATA[
<dependency>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<version>version</version>
<properties>
<eclipse.dependency>true</eclipse.dependency>
</properties>
</dependency>
]]></source>
<p>
This indicates that the dependency is another project in the workspace.
Note that the name of the referenced project is the artifactId.
</p>
<p>
The inverse also works. If you have included extra jars that shouldn't be
in the eclipse classpath then you can set <code>eclipse.dependency=false</code>
</p>
</section>
<section name="Generated Source Code integration w/ Eclipse">
<p>
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.
</p>
<p>
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.
</p>
<p>
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/.
<br/>
Settings in project.properties:
<source>
maven.xdoclet.hibernatedoclet.destDir=${maven.build.dir}/generated-sources/xdoclet
maven.hibernate.output.dir=${maven.build.dir}/generated-sources/schema
</source>
</p>
</section>
</body>
</document>