Setting build parameters with .properties files

Usually, DITA builds require setting a number of parameters that do not change frequently. You can reference a set of build parameters defined in a .properties file when building output with the dita command. If needed, you can override any parameter by specifying it explicitly as an argument to the dita command.

About .properties files

A .properties file is a text file that enumerates one or more name-value pairs, one per line, in the format name = value. The .properties filename extension is customarily used, but is not required.

  • Lines beginning with the # character are comments.
  • Properties specified as arguments of the dita command override those set in .properties files.
    Restriction: For this reason, args.input and transtype can't be set in the .properties file.
  • If you specify the same property more than once, the last instance is used.
  • Properties not used by the selected transformation type are ignored.
  • Properties can reference other property values defined elsewhere in the .properties file or passed by the dita command. Use the Ant ${property.name} syntax.
  • You can set properties not only for the default DITA-OT transformation types, but also for custom plugins.

Procedure

  1. Create your .properties file.
    Tip: Copy dita-ot-dir/docsrc/samples/properties/template.properties; this template describes each of the properties you can set.
    For example:
    args.gen.task.lbl = NO
    args.cssroot = ${args.input.dir}/css/
    args.css = style.css
    args.copycss = yes
    args.csspath = branding
    nav-toc = full
    args.xhtml.toc = toc
  2. Reference your .properties file with the dita command when building your output.
    dita -i my.ditamap -f html5 -propertyfile my.properties
  3. If needed, pass additional arguments to the dita command to override specific build parameters.

    For example, to build output once with <draft> and <required-cleanup> content:

    dita -i my.ditamap -f html5 -propertyfile my.properties -Dargs.draft=yes
    Tip: If you are building in different environments where the location of the input files is not consistent, set args.input.dir with the dita command and reference its value with ${args.input.dir} in your .properties file.