JAM supports both XDoclet and UML-based code generation via the standard gen target.
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 gen target.
UML-based code generation is supported through the use of dual source directories: src and
src-gen. Code found in the src-gen directory has the following characteristics:
src directory.src and src-gen, the
copy found in src-gen is moved to a backup directory.ant clean.gen
src-gen code 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:
<import file="${jam.home}/javagen-ws.xml"/> 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"/>