Women in Technology

Hear us Roar



Article:
  Developing with JAXB and Ant, Part 1
Subject:   automatic running of xjc with ant
Date:   2002-03-08 01:25:23
From:   f.meissner@web.de
Hi,


it got me some work but at last I achieved it. Here is a short excerpt from our ant file to update the necessary files automatically.


Mail me, if it is hard to read or the like...


fm@lambdalogic.de


<target depends="check.invoice.dtd.uptodate" name="invoice.jaxb.classes" unless="not.invoice.xml.source.uptodate">
<delete>
<fileset dir="com/lambdalogic/messeinfo/application/list/report/invoice/model/generated"/>
</delete>
<java classname="com.sun.tools.xjc.Main">
<arg value="${basedir}/com/lambdalogic/messeinfo/application/list/report/invoice/dtd/invoice.dtd"/>
<arg value="${basedir}/com/lambdalogic/messeinfo/application/list/report/invoice/model/Invoice.xjs"/>
<arg line="-d ${basedir}/"/>
<classpath>
<pathelement path="${classpath}"/>
</classpath>
</java>
</target>



<target depends="generated.invoice.files.avaible.check" if="generatable.files" name="check.invoice.dtd.uptodate">
<uptodate property="not.invoice.xml.source.uptodate" targetfile="${basedir}/com/lambdalogic/messeinfo/application/list/report/invoice/model/generated/Invoice.java">
<srcfiles dir="${basedir}/com/lambdalogic/messeinfo/application/list/report/invoice/dtd/" includes="*.*"/>
</uptodate>
</target>


<target name="generated.invoice.files.avaible.check">
<available file="com/lambdalogic/messeinfo/application/list/report/invoice/model/generated/Invoice.java" property="generatable.files"/>
</target>