plugin-anttarget.dita 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
  3. <!-- This file is part of the DITA Open Toolkit project. See the accompanying LICENSE file for applicable license. -->
  4. <task id="plugin-anttarget" xml:lang="en-US">
  5. <title>Adding a new target to the Ant build process</title>
  6. <shortdesc>As of DITA-OT 3.0, the <codeph>ant.import</codeph> extension point can be used to make new targets
  7. available to the Ant processing pipeline. This can be done as part of creating a new transformation, extending
  8. pre-processing, or simply to make new Ant targets available to other plug-ins.</shortdesc>
  9. <prolog>
  10. <metadata>
  11. <keywords>
  12. <indexterm>plug-ins<indexterm>Ant</indexterm></indexterm>
  13. <indexterm><codeph>ant.import</codeph></indexterm>
  14. <indexterm>preprocessing</indexterm>
  15. <indexterm>Ant<indexterm>targets</indexterm></indexterm>
  16. </keywords>
  17. </metadata>
  18. </prolog>
  19. <taskbody>
  20. <steps>
  21. <step>
  22. <cmd>Create an Ant project file that contains the new target(s).</cmd>
  23. </step>
  24. <step>
  25. <cmd>Create the <filepath>plugin.xml</filepath> file:</cmd>
  26. <stepxmp><codeblock outputclass="language-xml normalize-space show-line-numbers show-whitespace">&lt;plugin id="<varname>plugin-id</varname>">
  27. &lt;feature extension="ant.import" file="<varname>build-file</varname>"/>
  28. &lt;/plugin></codeblock>where:
  29. <ul>
  30. <li><varname>plugin-id</varname> is the plug-in identifier, for example,
  31. <codeph>com.example.ant</codeph>.</li>
  32. <li><varname>build-file</varname> is the Ant project file that contains the new build target(s).</li>
  33. </ul></stepxmp>
  34. </step>
  35. <step>
  36. <cmd>Install the plug-in.</cmd>
  37. </step>
  38. </steps>
  39. <result>
  40. <p>The targets from the project (<varname>build-file</varname>) are copied into the <filepath>build.xml</filepath>
  41. file, using the correct path. This makes the new Ant targets available to other processes.</p>
  42. <note type="tip">Earlier versions of DITA-OT use the <codeph>dita.conductor.target.relative</codeph> to call a
  43. wrapper file with a dummy task that imports the Ant project file. This approach is still supported for backwards
  44. compatibility, but the simpler <codeph>ant.import</codeph> approach described above should be used for all new
  45. customizations.</note>
  46. </result>
  47. </taskbody>
  48. </task>