Generating Documents with Ant

How to generate documents from the command line with Ant.

  1. Open a command prompt.
  2. Change directories to where the DITA-OT is installed on your machine.
  3. Set up the processing environment. Enter the following command:
    startcmd.bat

    Another command prompt appears with DITA-OT in the title bar, as shown in the following figure:

  4. Run a convertion to a transformation output type. Enter the following command and press the Enter key:
    ant -Dargs.input=source -Dtranstype=transtype

    The following table describes this command.

    Syntax Description
    ant Starts the Ant build tool installed as part of DITA-OT.
    -Dargs.input=source The source specifies the DITA topic or map to process. If the build file is not in the current directory, you must specify the path to the file.
    -Dtranstype=format The format specifies the transformation output type to generate.

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

    ant -Dargs.input=samples\hierarchy.ditamap -Dtranstype=xhtml

    DITA-OT displays a lot of output in the console window, including whether the build failed or succeeded at the end of the output.

    DITA-OT Build Success Message

    When your build is unsuccessful, the error message may be difficult to find in the copious output. If you have not configured your console window most of the early output may have already scrolled off the screen. If you add an Ant property, -l log-file to the command line invocation, DITA-OT will save the output to a log file that you can study after the build finishes.