This document will help you get started with a custom Ant build untill a sample Ant-based project becomes available. We do suggest trying out the Maven-based Quickstarter though ;-)
First of all you need to declare the task in your build file:
<taskdef
classpathref="some.classpath.id"
classname="gr.abiss.md4j.tools.ant.HibernateMappingProcessorTask"
name="md4j"
/>
Alternatively ommiting the classpathref attribute (or equal) should work just fine
if you place the MD4J JAR in $ANT_HOME/lib (%ANT_HOME%\lib on windows).
Using the task after declaring it is rather straighforward. A typical example is:
<md4j basedir="${mappings.dir}" destdir="${build.dir}/src"
excludes="**/named-queries.hbm.xml,**/*hibernate*.xml" force="true"
packageName="${app.package.pojos}">
<contextParam name="ejbdocletViewMethod" value="both"/>
<contextParam name="remoteEjbViewMethod" value="false"/>
<xmlcatalog>
<dtd publicId="-//Hibernate/Hibernate Mapping DTD 3.0//EN"
location="${dtds.dir}/hibernate-mapping-3.0.dtd"/>
</xmlcatalog>
</md4j>
Your build should also define buildtime and runtime dependencies, with the latter being included in your packaged application for runtime use. You can see the main dependencies here although that does not cover the web tier (Struts, JSTL etc). Another way to pin this down is to check out the Quickstarter EAR module's POM.
See JSP Dependencies.