First of all you need to declare the task in your build file:
<taskdef classpathref="some.classpath.id" classname="com.geekologue.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>