Migrating Ant builds to use the <cmdname>dita</cmdname> command Although Ant builds are still supported in the DITA Open Toolkit, you might want to switch to use the new dita command.

Building output with the dita command is often easier than using Ant. In particular, you can use .properties files to specify sets of DITA-OT parameters for each build.

You can include the dita command in shell scripts to perform multiple builds.

In your Ant build file, identify the properties set in each build target. Some build parameters might be specified as properties of the project as a whole. You can refer to a build log to see a list of all properties that were set for the build. Create a .properties file for each build and specify the needed build parameters, one per line, in the format name = value. Use the dita command to perform each build, referencing your .properties file with the -propertyfile option. Example: Ant build

Sample build file: dita-ot-dir/docsrc/samples/ant_sample/build-chm-pdf.xml

Example: <filepath>.properties</filepath> files with <cmdname>dita</cmdname> command

The following .properties files and dita commands are equivalent to the example Ant build.

Sample .properties file: /properties/chm.properties

Sample .properties file: /properties/pdf.properties

Run from :

-input sequence.ditamap -format htmlhelp -propertyfile properties/chm.properties -input taskbook.ditamap -format pdf -propertyfile properties/pdf.properties
Example: Call the <cmdname>dita</cmdname> 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.

Sample build file: /ant_sample/build-chm-pdf-hybrid.xml