Basically you need to specify two things in the Ant build.xml file: the taskdef for xbook
and the actual xbook task.
The xbook task takes the standard parameters also used in the script: book, dest and lite (boolean).
Important is that Ant can find xbook.jar and xbookaux.jar
This may be done by providing these jars within the classpath, through standard Ant extensibility
or explicitly when defining the task (as done in the example).
NOTE: conflicts may arise when Xalan is in your Ant lib dir. You may then see something like
"nl.justobjects.xbook.XSLTHelper class not found". In that case you may better invoke xbook
through a standard Ant java task (see below).
The xbook task takes the standard parameters also used in the script: book, dest and lite (boolean).
Here is an example:
<!-- Defines the XBook task and its CLASSPATH -->
<taskdef name="xbook" classname="nl.justobjects.xbook.XBookAntTask">
<classpath>
<pathelement location="${basedir}/../lib/xbook.jar"/>
<pathelement location="${basedir}/../lib/xbookaux.jar"/>
</classpath>
</taskdef>
<!-- Invoke XBook -->
<target name="main">
<xbook book="${basedir}/book.xml" dest="${basedir}/result" lite="true"/>
</target>
|
|
This is often the safest way when CLASSPATH issues and Xalan conflicts
arise when using the XBookAntTask. Here is an example.
<target name="xbookexec">
<java classname="nl.justobjects.xbook.XBook" fork="true"
failonerror="true"
maxmemory="128m"
>
<arg value="-lite"/>
<arg value="${basedir}/book.xml"/>
<arg value="${basedir}/result"/>
<classpath>
<pathelement location="${basedir}/../lib/xbook.jar"/>
<pathelement location="${basedir}/../lib/xbookaux.jar"/>
</classpath>
</java>
</target>
|
|