plugin-anttarget.dita 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. <taskbody>
  10. <steps>
  11. <step>
  12. <cmd>Create an Ant project file that contains the new target(s).</cmd>
  13. </step>
  14. <step>
  15. <cmd>Create the <filepath>plugin.xml</filepath> file:</cmd>
  16. <stepxmp><codeblock>&lt;plugin id="<varname>plugin-id</varname>">
  17. &lt;feature extension="ant.import" file="<varname>build-file</varname>"/>
  18. &lt;/plugin></codeblock>where:
  19. <ul>
  20. <li><varname>plugin-id</varname> is the plug-in identifier, for example,
  21. <codeph>com.example.ant</codeph>.</li>
  22. <li><varname>build-file</varname> is the Ant project file that contains the new build target(s).</li>
  23. </ul></stepxmp>
  24. </step>
  25. <step>
  26. <cmd>Install the plug-in.</cmd>
  27. </step>
  28. </steps>
  29. <result>
  30. <p>The targets from the project (<varname>build-file</varname>) are copied into the <filepath>build.xml</filepath>
  31. file, using the correct path. This makes the new Ant targets available to other processes.</p>
  32. <note type="tip">Earlier versions of DITA-OT use the <codeph>dita.conductor.target.relative</codeph> to call a
  33. wrapper file with a dummy task that imports the Ant project file. This approach is still supported for backwards
  34. compatibility, but the simpler <codeph>ant.import</codeph> approach described above should be used for all new
  35. customizations.</note>
  36. </result>
  37. </taskbody>
  38. </task>