You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ant.html 7.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Ant Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="ant">Ant</a></h2>
  8. <h3>Description</h3>
  9. <p>Runs Ant on a supplied buildfile. This can be used to build subprojects.</p>
  10. <p>When the <i>antfile</i> attribute is omitted, the file &quot;build.xml&quot;
  11. in the supplied directory (<i>dir</i> attribute) is used.</p>
  12. <p>If no target attribute is supplied, the default target of the new project is
  13. used.</p>
  14. <p>By default, all of the properties of the current project will be
  15. available in the new project. Alternatively, you can
  16. set the <i>inheritAll</i> attribute to <code>false</code> and only
  17. &quot;user&quot; properties (i.e., those passed on the command-line)
  18. will be passed to the new project. In either case, the set of
  19. properties passed to the new project will override the properties that
  20. are set in the new project (See also the <a href="property.html">property task</a>).</p>
  21. <p>You can also set properties in the new project from the old project by
  22. using nested property tags. These properties are always passed regardless of the
  23. setting of <i>inheritAll</i>. This allows you to parameterize your subprojects.</p>
  24. <p>References to data types can also be passed to the new project, but
  25. by default they are not. If you set the inheritrefs attribute to
  26. true, all references will be copied, but they will not override
  27. references defined in the new project.</p>
  28. <p>Nested <a href="#reference"><i>&lt;reference&gt;</i></a> elements
  29. can also be used to copy references from the calling project to the
  30. new project, optionally under a different id. References taken from
  31. nested elements will override existing references in the new
  32. project.</p>
  33. <h3>Parameters</h3>
  34. <table border="1" cellpadding="2" cellspacing="0">
  35. <tr>
  36. <td valign="top"><b>Attribute</b></td>
  37. <td valign="top"><b>Description</b></td>
  38. <td align="center" valign="top"><b>Required</b></td>
  39. </tr>
  40. <tr>
  41. <td valign="top">antfile</td>
  42. <td valign="top">the buildfile to use. Defaults to
  43. &quot;build.xml&quot;. This file is expected to be a filename
  44. relative to the dir attribute given.</td>
  45. <td valign="top" align="center">No</td>
  46. </tr>
  47. <tr>
  48. <td valign="top">dir</td>
  49. <td valign="top">the directory to use as a basedir for the new Ant project.
  50. Defaults to the current project's basedir, unless
  51. inheritall has been set to false, in which case it doesn't
  52. have a default value. This will override the basedir
  53. setting of the called project.</td>
  54. <td valign="top" align="center">No</td>
  55. </tr>
  56. <tr>
  57. <td valign="top">target</td>
  58. <td valign="top">the target of the new Ant project that should be executed.
  59. Defaults to the new project's default target.</td>
  60. <td valign="top" align="center">No</td>
  61. </tr>
  62. <tr>
  63. <td valign="top">output</td>
  64. <td valign="top">Filename to write the ant output to.
  65. </td>
  66. <td align="center" valign="top">No</td>
  67. </tr>
  68. <tr>
  69. <td valign="top">inheritAll</td>
  70. <td valign="top">If <code>true</code>, pass all properties to the
  71. new Ant project. Defaults to <code>true</code>.</td>
  72. <td align="center" valign="top">No</td>
  73. </tr>
  74. <tr>
  75. <td valign="top">inheritRefs</td>
  76. <td valign="top">If <code>true</code>, pass all references to the
  77. new Ant project. Defaults to <code>false</code>.</td>
  78. <td align="center" valign="top">No</td>
  79. </tr>
  80. </table>
  81. <h3>Parameters specified as nested elements</h3>
  82. <h4>property</h4>
  83. <p>See the description of the <a href="property.html">property task</a>.</p>
  84. <h4><a name="reference">reference</a></h4>
  85. <p>Used to chose references that shall be copied into the new project,
  86. optionally changing their id.</p>
  87. <table border="1" cellpadding="2" cellspacing="0">
  88. <tr>
  89. <td valign="top"><b>Attribute</b></td>
  90. <td valign="top"><b>Description</b></td>
  91. <td align="center" valign="top"><b>Required</b></td>
  92. </tr>
  93. <tr>
  94. <td valign="top">refid</td>
  95. <td valign="top">The id of the reference in the calling project.</td>
  96. <td valign="top" align="center">Yes</td>
  97. </tr>
  98. <tr>
  99. <td valign="top">torefid</td>
  100. <td valign="top">The id of the reference in the new project.</td>
  101. <td valign="top" align="center">No, defaults to the value of refid.</td>
  102. </tr>
  103. </table>
  104. <h3>Basedir of the new project</h3>
  105. <p>The basedir value of the new project is affected by the two
  106. attributes dir and inheritall, see the following table for
  107. details:</p>
  108. <table border="1" cellpadding="2" cellspacing="0">
  109. <tr>
  110. <td valign="top"><b>dir attribute</b></td>
  111. <td valign="top"><b>inheritAll attribute</b></td>
  112. <td valign="top"><b>new project's basedir</b></td>
  113. </tr>
  114. <tr>
  115. <td valign="top">value provided</td>
  116. <td valign="top">true</td>
  117. <td valign="top">value of dir attribute</td>
  118. </tr>
  119. <tr>
  120. <td valign="top">value provided</td>
  121. <td valign="top">false</td>
  122. <td valign="top">value of dir attribute</td>
  123. </tr>
  124. <tr>
  125. <td valign="top">omitted</td>
  126. <td valign="top">true</td>
  127. <td valign="top">basedir of calling project (the one whose build
  128. file contains the &lt;ant&gt; task).</td>
  129. </tr>
  130. <tr>
  131. <td valign="top">omitted</td>
  132. <td valign="top">false</td>
  133. <td valign="top">basedir attribute of the &lt;project&gt; element
  134. of the new project</td>
  135. </tr>
  136. </table>
  137. <h3>Examples</h3>
  138. <pre>
  139. &lt;ant antfile=&quot;subproject/subbuild.xml&quot; dir=&quot;subproject&quot; target=&quot;compile&quot;/&gt;
  140. &lt;ant dir=&quot;subproject&quot;/&gt;
  141. &lt;ant antfile=&quot;subproject/property_based_subbuild.xml&quot;&gt;
  142. &lt;property name=&quot;param1&quot; value=&quot;version 1.x&quot;/&gt;
  143. &lt;property file=&quot;config/subproject/default.properties&quot;/&gt;
  144. &lt;/ant&gt;
  145. &lt;ant inheritAll=&quot;false&quot; antfile=&quot;subproject/subbuild.xml&quot;&gt;
  146. &lt;property name=&quot;output.type&quot; value=&quot;html&quot;/&gt;
  147. &lt;/ant&gt;
  148. </pre>
  149. <p>The build file of the calling project defines some
  150. <code>&lt;path&gt;</code> elements like this:</p>
  151. <pre>
  152. &lt;path id="path1"&gt;
  153. ...
  154. &lt;/&gt;
  155. &lt;path id="path2"&gt;
  156. ...
  157. &lt;/&gt;
  158. </pre>
  159. <p>and the called build file (<code>subbuild.xml</code>) also defines
  160. a <code>&lt;path&gt;</code> with the id <code>path1</code>, but
  161. <code>path2</code> is not defined:</p>
  162. <pre>
  163. &lt;ant antfile=&quot;subbuild.xml&quot; inheritrefs=&quot;true&quot; /&gt;
  164. </pre>
  165. <p>will not override <code>subbuild</code>'s definition of
  166. <code>path1</code>, but make the parent's definition of
  167. <code>path2</code> available in the subbuild.</p>
  168. <pre>
  169. &lt;ant antfile=&quot;subbuild.xml&quot; /&gt;
  170. </pre>
  171. <p>as well as</p>
  172. <pre>
  173. &lt;ant antfile=&quot;subbuild.xml&quot; inheritrefs=&quot;false&quot; /&gt;
  174. </pre>
  175. <p>will neither override <code>path1</code> nor copy
  176. <code>path2</code>.</p>
  177. <pre>
  178. &lt;ant antfile=&quot;subbuild.xml&quot; inheritrefs=&quot;false&quot; &gt;
  179. &lt;reference refid=&quot;path1&quot; /&gt;
  180. &lt;/ant&gt;
  181. </pre>
  182. <p>will override <code>subbuild</code>'s definition of
  183. <code>path1</code>.</p>
  184. <pre>
  185. &lt;ant antfile=&quot;subbuild.xml&quot; inheritrefs=&quot;false&quot; &gt;
  186. &lt;reference refid=&quot;path1&quot; torefid=&quot;path2&quot; /&gt;
  187. &lt;/ant&gt;
  188. </pre>
  189. <p>will copy the parent's definition of <code>path1</code> into the
  190. new project using the id <code>path2</code>.</p>
  191. <hr>
  192. <p align="center">Copyright &copy; 2001-2002 Apache Software Foundation. All rights
  193. Reserved.</p>
  194. </body>
  195. </html>