Add better support for generated sources

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115648 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
epugh
2004-07-04 16:20:28 +00:00
parent 3f9b967188
commit 5bf7cc3091
4 changed files with 126 additions and 46 deletions

View File

@@ -81,7 +81,7 @@
the classpath, like <code>src/conf</code>.
</td>
</tr>
<tr>
<tr>
<td>maven.eclipse.buildcommands</td>
<td>Yes</td>
<td>
@@ -89,7 +89,7 @@
to include in the project description file.
</td>
</tr>
<tr>
<tr>
<td>maven.eclipse.projectnatures</td>
<td>Yes</td>
<td>
@@ -98,6 +98,16 @@
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
@@ -132,5 +142,36 @@
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>