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. Enter the following command: startcmd.bat Another command prompt appears with DITA-OT in the title bar, as shown in the following figure:

  4. Enter the following command and press the Enter key: ant -f buildfile target

    The following table describes this command.

    Syntax Description
    ant Starts the Ant build tool installed as part of DITA-OT.
    -f buildfile Specifies the build file containing instructions on how to compile your document project. If the build file is not in the current directory, you must specify the path to the file.
    target Specifies the desired output type of the document project. DITA Open Toolkit supports the following targets:
    • dita2PDF
    • dita2xhtml
    • dita2htmlhelp
    • dita2eclipsehelp
    • dita2eclipsecontent
    • dita2rtf
    • dita2javahelp
    • dita2troff

    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, -logger to the command line invocation, DITA-OT will save the output to a log file that you can study after the build finishes.