JAM supports both XDoclet and UML-based code generation via the standard
XDoclet is invoked by default in the
gen standard target to generate various J2EE deployment
descriptors and support classes. XDoclet output is treated as build artifacts. In other words, each
time you do a clean build, all XDoclet output is regenerated.
To remove XDoclet calls simply override the
gen target and remove the xdoclet target from
the depends clause. Likewise, to modify the XDoclet call, override the xdoclet support target or write
your own and include it in the depends clause of the your overridden
UML-based code generation is supported through the use of dual source directories:
src-gen. Code found in the
src-gen directory has the following characteristics:
src-gen, the copy found in
src-genis moved to a backup directory.
src-gencode is regenerated automatically whenever the UML file is modified.
If you need to modify a file in
src-gen, move it to
src so it will not
be overwritten on subsequent regeneration cycles.
JavaGen is a sophisticated J2EE UML-based code generator with a very capable, freely available community edition. JavaGen generates EJB and webapp code, including XDoclet tags based on the application server and database you are using. The web service interface of JavaGen can be added to your build by importing the JavaGen module:
And then adding the
javagen dependency to the
gen target. In the
case of an EJB project the overridden
gen target would look something like this:
<target name="gen" depends="init, javagen, ejbdoclet"/>
If you are not using the
src-gen directory, it can be hidden from view by placing the
following property definition at the top of your build file:
<property name="gen.src.folder" value="target/noop-src-gen"/>