Example: Call the dita command from an Ant build
In some cases, you might still want to use an Ant build to implement some pre- or post-processing steps, but
also want the convenience of using the dita command with .properties
files to define the parameters for each build. This can be accomplished with Ant's exec
task.
This example uses a dita-cmd Ant macro defined in the /ant_sample/dita-cmd.xml file:
You can use this macro in your Ant build to call the dita command and pass the
input, format and propertyfile parameters as
follows:
<dita-cmd input="sample.ditamap" format="pdf" propertyfile="sample.properties"/>
This approach allows you to use Ant builds to perform additional tasks at build time while allowing the
dita command to set the classpath and ensure that all necessary JAR libraries are
available.
The attributes defined in the Ant macro are required and must be supplied each time the task is run. To set
optional parameters in one build (but not another), use different .properties files for
each build.
Sample build file: /ant_sample/build-chm-pdf-hybrid.xml