Running Ant

After setting up the Ant environment, you can build the DITA output by running the ant command.

Here are some samples to explain how to use Ant to build sample output in the DITA directory.

Note: To run the Ant demo properly, you should switch to the DITA-OT installation directory under the command prompt. If you are using the "Full Easy Install" package, running the startcmd.bat batch file in that directory will give you a prompt that is already set up for the following commands.

To build XHTML output for the sample DITA map samples/hierarchy.ditamap, run the command:

ant -Dargs.input=samples/hierarchy.ditamap -Doutput.dir=out/samples/web -Dtranstype=xhtml 

This will generate the output into out/samples/web directory. The samples directory also contains dedicated Ant build files for various transformation types and the same output can be generated with the sample_xhtml.xml:

ant -f samples/ant_sample/sample_xhtml.xml

You can build all samples in the DITA directory:

ant -f build_demo.xml all

The building process will create an /out/ directory and put the output files in subdirectories that parallel the source directory.

Note: To find out the complete list of targets you can clean and build, check the name attributes for the target elements within the build_demo.xml file. Or, input ant -f build_demo.xml -projecthelp for a full list information.
You can also build your own selections using a prompted build.
ant -f build_demo.xml

Ant will prompt you for the input file, output directory, and transform type. Values on these parameters are case sensitive.

Note: To troubleshoot problems in setting up Java, Ant, Saxon, or FOP, you will get better information from the communities for those components rather than the communities for the DITA. Of course, if you find issues relevant to the DITA XSLT scripts (or have ideas for improving them), you are encouraged to engage the DITA community.