using-dita-properties-file.html 9.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <!DOCTYPE html
  2. SYSTEM "about:legacy-compat">
  3. <html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2019"><meta name="DC.rights.owner" content="(C) Copyright 2019"><meta name="DC.type" content="task"><meta name="description" content="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."><meta name="DC.subject" content="draft, required-cleanup, command, dita, .properties file, DITA maps, properties file"><meta name="keywords" content="draft, required-cleanup, command, dita, .properties file, DITA maps, properties file"><meta name="DC.relation" scheme="URI" content="../topics/build-using-dita-command.html"><meta name="DC.format" content="HTML5"><meta name="DC.identifier" content="using-dita-properties-file"><link rel="stylesheet" type="text/css" href="../css/commonltr.css"><link rel="stylesheet" type="text/css" href="../css/dita-ot-doc.css"><title>Setting build parameters with .properties files</title></head><body id="using-dita-properties-file"><header role="banner"><div class="header">
  4. <p>DITA Open Toolkit</p>
  5. <hr>
  6. </div></header><nav role="toc"><ul><li><a href="../index.html">DITA Open Toolkit 3.3</a></li><li><a href="../release-notes/index.html">Release Notes</a></li><li><a href="../topics/installing-client.html">Installing DITA-OT</a></li><li><a href="../topics/alternative-input-formats.html">Authoring formats</a></li><li><a href="../topics/building-output.html">Building output</a><ul><li><a href="../topics/build-using-dita-command.html">Using the dita command</a><ul><li class="active"><a href="../topics/using-dita-properties-file.html">Using a properties file</a></li><li><a href="../topics/migrating-ant-to-dita.html">Migrating Ant builds</a></li></ul></li><li><a href="../topics/publishing-with-ant.html">Using Ant</a></li><li><a href="../reference/java-api.html">Using the Java API</a></li><li><a href="../topics/output-formats.html">Output formats</a></li></ul></li><li><a href="../parameters/index.html">Setting parameters</a></li><li><a href="../topics/customizing.html">Customizing DITA-OT</a></li><li><a href="../topics/troubleshooting-overview.html">Troubleshooting</a></li><li><a href="../reference/index.html">Reference</a></li><li><a href="../topics/dita-and-dita-ot-resources.html">Resources</a></li></ul></nav><main role="main"><article role="article" aria-labelledby="ariaid-title1">
  7. <h1 class="title topictitle1" id="ariaid-title1">Setting build parameters with <span class="ph filepath">.properties</span> files</h1>
  8. <div class="body taskbody"><p class="shortdesc">Usually, DITA builds require setting a number of parameters that do not change frequently. You can
  9. reference a set of build parameters defined in a <span class="ph filepath">.properties</span> file when building output with the
  10. <span class="keyword cmdname">dita</span> command. If needed, you can override any parameter by specifying it explicitly as an
  11. argument to the <span class="keyword cmdname">dita</span> command.</p>
  12. <section class="section"><h2 class="title sectiontitle">About <span class="ph filepath">.properties</span> files</h2>
  13. <p class="p">A <span class="ph filepath">.properties</span> file is a text file that enumerates one or more name-value pairs, one per
  14. line, in the format <code class="ph codeph">name = value</code>. The <span class="ph filepath">.properties</span> filename extension is
  15. customarily used, but is not required.</p>
  16. <ul class="ul" compact>
  17. <li class="li">Lines beginning with the <code class="ph codeph">#</code> character are comments.</li>
  18. <li class="li">Properties specified as arguments of the <span class="keyword cmdname">dita</span> command override those set in
  19. <span class="ph filepath">.properties</span> files. <div class="note restriction note_restriction"><span class="note__title">Restriction:</span> For this reason,
  20. <span class="keyword parmname">args.input</span> and <span class="keyword parmname">transtype</span> can’t be set in the
  21. <span class="ph filepath">.properties</span> file.</div></li>
  22. <li class="li">If you specify the same property more than once, the last instance is used.</li>
  23. <li class="li">Properties not used by the selected transformation type are ignored.</li>
  24. <li class="li">Properties can reference other property values defined elsewhere in the <span class="ph filepath">.properties</span>
  25. file or passed by the <span class="keyword cmdname">dita</span> command. Use the Ant
  26. <code class="ph codeph">${<var class="keyword varname">property.name</var>}</code> syntax.</li>
  27. <li class="li">You can set properties not only for the default DITA-OT transformation types, but also for custom plugins.
  28. </li>
  29. </ul>
  30. </section>
  31. <section><div class="tasklabel"><h2 class="sectiontitle tasklabel">Procedure</h2></div><ol class="ol steps"><li class="li step stepexpand">
  32. <span class="ph cmd">Create your <span class="ph filepath">.properties</span> file.</span>
  33. <div class="itemgroup info">
  34. <div class="note tip note_tip"><span class="note__title">Tip:</span> Copy <span class="ph filepath"><var class="keyword varname">dita-ot-dir</var>/docsrc/samples</span><span class="ph filepath">/properties/template.properties</span>; this template describes each of the properties you can
  35. set.</div>
  36. </div>
  37. <div class="itemgroup stepxmp">
  38. <p class="p">For example:</p>
  39. <div class="p"><pre class="pre codeblock language-properties normalize-space show-line-numbers show-whitespace"><code># Don't generate headings for sections within task topics:
  40. args.gen.task.lbl = NO
  41. # Directory that contains the custom .css file:
  42. args.cssroot = ${args.input.dir}/css/
  43. # Custom .css file used to style output:
  44. args.css = style.css
  45. # Copy the custom .css file to the output directory:
  46. args.copycss = yes
  47. # Location of the copied .css file relative to the output:
  48. args.csspath = branding
  49. # Generate a full navigation TOC in topic pages:
  50. nav-toc = full
  51. # Base name of the Table of Contents file:
  52. args.xhtml.toc = toc</code></pre>
  53. </div>
  54. </div>
  55. </li><li class="li step stepexpand">
  56. <span class="ph cmd">Reference your <span class="ph filepath">.properties</span> file with the <span class="keyword cmdname">dita</span> command when building
  57. your output.</span>
  58. <div class="itemgroup stepxmp">
  59. <pre class="pre codeblock"><code><span class="keyword cmdname">dita</span> <span class="keyword parmname">--input</span>=<var class="keyword varname">my.ditamap</var> <span class="keyword parmname">--format</span>=<span class="keyword option">html5</span> <span class="keyword parmname">--propertyfile</span>=<var class="keyword varname">my.properties</var></code></pre>
  60. </div>
  61. <div class="itemgroup info"></div>
  62. </li><li class="li step stepexpand">
  63. <span class="ph cmd">If needed, pass additional arguments to the <span class="keyword cmdname">dita</span> command to override specific build
  64. parameters. </span>
  65. <div class="itemgroup stepxmp">
  66. <p class="p">For example, to build output once with <code class="keyword markupname xmlelement">&lt;draft&gt;</code> and
  67. <code class="keyword markupname xmlelement">&lt;required-cleanup&gt;</code> content:</p>
  68. <pre class="pre codeblock"><code><span class="keyword cmdname">dita</span> <span class="keyword parmname">--input</span>=<var class="keyword varname">my.ditamap</var> <span class="keyword parmname">--format</span>=<span class="keyword option">html5</span> <span class="keyword parmname">--propertyfile</span>=<var class="keyword varname">my.properties</var> \
  69. <span class="keyword parmname">--args.draft</span>=<span class="keyword option">yes</span></code></pre>
  70. </div>
  71. <div class="itemgroup info">
  72. <div class="note tip note_tip"><span class="note__title">Tip:</span> If you are building in different environments where the location of the input
  73. files is not consistent, set <span class="keyword option">args.input.dir</span> with the <span class="keyword cmdname">dita</span> command and
  74. reference its value with <code class="ph codeph">${args.input.dir}</code> in your <span class="ph filepath">.properties</span>
  75. file.
  76. </div>
  77. </div>
  78. </li></ol></section>
  79. </div>
  80. <nav role="navigation" class="related-links"><div class="familylinks"><div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../topics/build-using-dita-command.html" title="You can generate output using the dita command-line tool. Build parameters can be specified on the command line or with .properties files.">Building output using the dita command</a></div></div></nav></article></main></body></html>