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.

subant.html 20 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Subant
  5. Task</title>
  6. </head>
  7. <body bgcolor="#ffffff" text="#000000" link="#525D76"
  8. alink="#525D76" vlink="#525D76">
  9. <table border="0" width="100%" cellspacing="4">
  10. <!-- PAGE HEADER -->
  11. <tr>
  12. <td>
  13. <table border="0" width="100%"><tr>
  14. <td valign="bottom">
  15. <font size="+3" face="arial,helvetica,sanserif"><strong>Subant
  16. Task</strong></font>
  17. <br><font face="arial,helvetica,sanserif"><i>EXPERIMENTAL:</i> This task is experimental and may be under continual change till Ant1.6 ships; it may even be omitted from the product.</font>
  18. </td>
  19. <td>
  20. <!-- PROJECT LOGO -->
  21. <a href="http://ant.apache.org/">
  22. <img src="../../images/ant_logo_large.gif" align="right" alt="Apache Ant" border="0"/>
  23. </a>
  24. </td>
  25. </tr></table>
  26. </td>
  27. </tr>
  28. <!-- START RIGHT SIDE MAIN BODY -->
  29. <tr>
  30. <td valign="top" align="left">
  31. <!-- Applying task/description -->
  32. <!-- Start Description -->
  33. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  34. <tr><td>&nbsp;</td></tr>
  35. <tr><td bgcolor="#525D76">
  36. <font color="#ffffff" face="arial,helvetica.sanserif">
  37. <a name="description">
  38. <strong>Description</strong></a></font>
  39. </td></tr>
  40. <tr><td><blockquote>
  41. <p>
  42. <i>EXPERIMENTAL:</i> This task is experimental and may be under continual
  43. change till Ant1.6 ships; it may even be omitted from the product.
  44. </p>
  45. <p>
  46. Calls a given target for all defined sub-builds. This is an extension
  47. of ant for bulk project execution.
  48. <strong>This task must no be used outside of a
  49. <code>target</code> if it invoces the same build file it is
  50. part of.</strong>
  51. </p>
  52. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  53. <!-- Subsection heading -->
  54. <tr><td bgcolor="#828DA6">
  55. <font color="#ffffff" face="arial,helvetica.sanserif">
  56. <a name="Use with directories">
  57. <strong>Use with directories</strong></a></font>
  58. </td></tr>
  59. <!-- Subsection body -->
  60. <tr><td>
  61. <p>
  62. subant can be used with directory sets to execute a build from different directories.
  63. 2 different options are offered :
  64. </p>
  65. <ul>
  66. <li>
  67. to run the same build file <code>/somepath/otherpath/mybuild.xml</code>
  68. with different base directories, use the genericantfile attribute
  69. </li>
  70. <li>if you want to run <code>directory1/mybuild.xml</code>, <code>directory2/mybuild.xml</code>, <code>....</code>,
  71. use the antfile attribute. The subant task does not set the base directory for you in this case.<br/> because you can specify it in each build file.
  72. </li>
  73. </ul>
  74. </td></tr>
  75. </table>
  76. </blockquote></td></tr>
  77. </table>
  78. <!-- End Description -->
  79. <!-- Start Attributes -->
  80. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  81. <tr><td>&nbsp;</td></tr>
  82. <tr><td bgcolor="#525D76">
  83. <font color="#ffffff" face="arial,helvetica.sanserif">
  84. <a name="attributes">
  85. <strong>Parameters</strong></a></font>
  86. </td></tr>
  87. <tr><td><blockquote>
  88. <table>
  89. <tr>
  90. <td bgcolor="#cccccc" valign="top" align="left">
  91. <font color="#000000" size="-1" face="arial,helvetica,sanserif"><b>Attribute</b></font>
  92. </td>
  93. <td bgcolor="#cccccc" valign="top" align="left">
  94. <font color="#000000" size="-1" face="arial,helvetica,sanserif"><b>Description</b></font>
  95. </td>
  96. <td bgcolor="#cccccc" valign="top" align="left">
  97. <font color="#000000" size="-1" face="arial,helvetica,sanserif"><b>Type</b></font>
  98. </td>
  99. <td bgcolor="#cccccc" valign="top" align="left">
  100. <font color="#000000" size="-1" face="arial,helvetica,sanserif"><b>Requirement</b></font>
  101. </td>
  102. </tr>
  103. <!-- Attribute Group -->
  104. <!-- Attribute Group -->
  105. <!-- Attribute -->
  106. <tr>
  107. <td bgcolor="#eeeeee" valign="top" align="left">
  108. <font color="#000000" size="-1" face="arial,helvetica,sanserif">antfile</font>
  109. </td>
  110. <td bgcolor="#eeeeee" valign="top" align="left">
  111. <font color="#000000" size="-1" face="arial,helvetica,sanserif">Build file name, to use in conjunction with directories.<br/> Defaults to "build.xml".<br/> If <code>genericantfile</code> is set, this attribute is ignored.</font>
  112. </td>
  113. <td bgcolor="#eeeeee" valign="top" align="left">
  114. <font color="#000000" size="-1" face="arial,helvetica,sanserif">String</font>
  115. </td>
  116. <td bgcolor="#eeeeee" valign="top" align="left" rowspan="9">
  117. <font color="#000000" size="-1" face="arial,helvetica,sanserif">Optional</font>
  118. </td>
  119. </tr>
  120. <!-- Attribute -->
  121. <tr>
  122. <td bgcolor="#eeeeee" valign="top" align="left">
  123. <font color="#000000" size="-1" face="arial,helvetica,sanserif">buildpath</font>
  124. </td>
  125. <td bgcolor="#eeeeee" valign="top" align="left">
  126. <font color="#000000" size="-1" face="arial,helvetica,sanserif">Set the buildpath to be used to find sub-projects.</font>
  127. </td>
  128. <td bgcolor="#eeeeee" valign="top" align="left">
  129. <font color="#000000" size="-1" face="arial,helvetica,sanserif">Path</font>
  130. </td>
  131. </tr>
  132. <!-- Attribute -->
  133. <tr>
  134. <td bgcolor="#eeeeee" valign="top" align="left">
  135. <font color="#000000" size="-1" face="arial,helvetica,sanserif">buildpathref</font>
  136. </td>
  137. <td bgcolor="#eeeeee" valign="top" align="left">
  138. <font color="#000000" size="-1" face="arial,helvetica,sanserif">Buildpath to use, by reference.</font>
  139. </td>
  140. <td bgcolor="#eeeeee" valign="top" align="left">
  141. <font color="#000000" size="-1" face="arial,helvetica,sanserif">Reference</font>
  142. </td>
  143. </tr>
  144. <!-- Attribute -->
  145. <tr>
  146. <td bgcolor="#eeeeee" valign="top" align="left">
  147. <font color="#000000" size="-1" face="arial,helvetica,sanserif">failonerror</font>
  148. </td>
  149. <td bgcolor="#eeeeee" valign="top" align="left">
  150. <font color="#000000" size="-1" face="arial,helvetica,sanserif">Sets whether to fail with a build exception on error, or go on.</font>
  151. </td>
  152. <td bgcolor="#eeeeee" valign="top" align="left">
  153. <font color="#000000" size="-1" face="arial,helvetica,sanserif">boolean</font>
  154. </td>
  155. </tr>
  156. <!-- Attribute -->
  157. <tr>
  158. <td bgcolor="#eeeeee" valign="top" align="left">
  159. <font color="#000000" size="-1" face="arial,helvetica,sanserif">genericantfile</font>
  160. </td>
  161. <td bgcolor="#eeeeee" valign="top" align="left">
  162. <font color="#000000" size="-1" face="arial,helvetica,sanserif">Build file path, to use in conjunction with directories.<br/> Use <code>genericantfile</code>, in order to run the same build file with different basedirs.<br/> If this attribute is set, <code>antfile</code> is ignored.</font>
  163. </td>
  164. <td bgcolor="#eeeeee" valign="top" align="left">
  165. <font color="#000000" size="-1" face="arial,helvetica,sanserif">File</font>
  166. </td>
  167. </tr>
  168. <!-- Attribute -->
  169. <tr>
  170. <td bgcolor="#eeeeee" valign="top" align="left">
  171. <font color="#000000" size="-1" face="arial,helvetica,sanserif">inheritall</font>
  172. </td>
  173. <td bgcolor="#eeeeee" valign="top" align="left">
  174. <font color="#000000" size="-1" face="arial,helvetica,sanserif">Corresponds to <code>&lt;ant&gt;</code>'s <code>inheritall</code> attribute.</font>
  175. </td>
  176. <td bgcolor="#eeeeee" valign="top" align="left">
  177. <font color="#000000" size="-1" face="arial,helvetica,sanserif">boolean</font>
  178. </td>
  179. </tr>
  180. <!-- Attribute -->
  181. <tr>
  182. <td bgcolor="#eeeeee" valign="top" align="left">
  183. <font color="#000000" size="-1" face="arial,helvetica,sanserif">inheritrefs</font>
  184. </td>
  185. <td bgcolor="#eeeeee" valign="top" align="left">
  186. <font color="#000000" size="-1" face="arial,helvetica,sanserif">Corresponds to <code>&lt;ant&gt;</code>'s <code>inheritrefs</code> attribute.</font>
  187. </td>
  188. <td bgcolor="#eeeeee" valign="top" align="left">
  189. <font color="#000000" size="-1" face="arial,helvetica,sanserif">boolean</font>
  190. </td>
  191. </tr>
  192. <!-- Attribute -->
  193. <tr>
  194. <td bgcolor="#eeeeee" valign="top" align="left">
  195. <font color="#000000" size="-1" face="arial,helvetica,sanserif">output</font>
  196. </td>
  197. <td bgcolor="#eeeeee" valign="top" align="left">
  198. <font color="#000000" size="-1" face="arial,helvetica,sanserif">Corresponds to <code>&lt;ant&gt;</code>'s <code>output</code> attribute.</font>
  199. </td>
  200. <td bgcolor="#eeeeee" valign="top" align="left">
  201. <font color="#000000" size="-1" face="arial,helvetica,sanserif">String</font>
  202. </td>
  203. </tr>
  204. <!-- Attribute -->
  205. <tr>
  206. <td bgcolor="#eeeeee" valign="top" align="left">
  207. <font color="#000000" size="-1" face="arial,helvetica,sanserif">target</font>
  208. </td>
  209. <td bgcolor="#eeeeee" valign="top" align="left">
  210. <font color="#000000" size="-1" face="arial,helvetica,sanserif"></font>
  211. </td>
  212. <td bgcolor="#eeeeee" valign="top" align="left">
  213. <font color="#000000" size="-1" face="arial,helvetica,sanserif">String</font>
  214. </td>
  215. </tr>
  216. </table>
  217. </blockquote></td></tr>
  218. </table>
  219. <!-- End Attributes -->
  220. <!-- Start Elements -->
  221. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  222. <tr><td>&nbsp;</td></tr>
  223. <tr><td bgcolor="#525D76">
  224. <font color="#ffffff" face="arial,helvetica.sanserif">
  225. <a name="elements">
  226. <strong>Parameters as nested elements</strong></a></font>
  227. </td></tr>
  228. <tr><td><blockquote>
  229. <!-- Start Element -->
  230. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  231. <tr><td>&nbsp;</td></tr>
  232. <tr><td bgcolor="#828DA6">
  233. <font color="#ffffff" face="arial,helvetica.sanserif" size="-1">
  234. <strong>dirset</strong> (org.apache.tools.ant.types.DirSet)</font>
  235. </td></tr>
  236. <tr><td><blockquote>
  237. Adds a directory set to the implicit build path. <p> <em>Note that the directories will be added to the build path in no particular order, so if order is significant, one should use a file list instead!</em>
  238. <short-description><![CDATA[Adds a directory set to the implicit build path.]]></short-description>
  239. <description>
  240. <![CDATA[Adds a directory set to the implicit build path. <p> <em>Note that the directories will be added to the build path in no particular order, so if order is significant, one should use a file list instead!</em>]]>
  241. </description>
  242. </blockquote></td></tr>
  243. </table>
  244. <!-- End Element -->
  245. <!-- Start Element -->
  246. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  247. <tr><td>&nbsp;</td></tr>
  248. <tr><td bgcolor="#828DA6">
  249. <font color="#ffffff" face="arial,helvetica.sanserif" size="-1">
  250. <strong>filelist</strong> (org.apache.tools.ant.types.FileList)</font>
  251. </td></tr>
  252. <tr><td><blockquote>
  253. Adds an ordered file list to the implicit build path. <p> <em>Note that contrary to file and directory sets, file lists can reference non-existent files or directories!</em>
  254. <short-description><![CDATA[Adds an ordered file list to the implicit build path.]]></short-description>
  255. <description>
  256. <![CDATA[Adds an ordered file list to the implicit build path. <p> <em>Note that contrary to file and directory sets, file lists can reference non-existent files or directories!</em>]]>
  257. </description>
  258. </blockquote></td></tr>
  259. </table>
  260. <!-- End Element -->
  261. <!-- Start Element -->
  262. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  263. <tr><td>&nbsp;</td></tr>
  264. <tr><td bgcolor="#828DA6">
  265. <font color="#ffffff" face="arial,helvetica.sanserif" size="-1">
  266. <strong>fileset</strong> (org.apache.tools.ant.types.FileSet)</font>
  267. </td></tr>
  268. <tr><td><blockquote>
  269. Adds a file set to the implicit build path. <p> <em>Note that the directories will be added to the build path in no particular order, so if order is significant, one should use a file list instead!</em>
  270. <short-description><![CDATA[Adds a file set to the implicit build path.]]></short-description>
  271. <description>
  272. <![CDATA[Adds a file set to the implicit]]><![CDATA[ build path. <p> <em>Note that the directories will be added to the build path in no particular order, so if order is significant, one should use a file list instead!</em>]]>
  273. </description>
  274. </blockquote></td></tr>
  275. </table>
  276. <!-- End Element -->
  277. <!-- Start Element -->
  278. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  279. <tr><td>&nbsp;</td></tr>
  280. <tr><td bgcolor="#828DA6">
  281. <font color="#ffffff" face="arial,helvetica.sanserif" size="-1">
  282. <strong>property</strong> (org.apache.tools.ant.taskdefs.Property)</font>
  283. </td></tr>
  284. <tr><td><blockquote>
  285. Corresponds to <code>&lt;ant&gt;</code>'s nested <code>&lt;property&gt;</code> element.
  286. <short-description><![CDATA[Corresponds to <code>&lt;ant&gt;</code>'s nested <code>&lt;property&gt;</code> element.]]></short-description>
  287. <description>
  288. <![CDATA[Corresponds to <code>&lt;ant&gt;</code>'s nested <code>&lt;property&gt;</code> element.]]>
  289. </description>
  290. </blockquote></td></tr>
  291. </table>
  292. <!-- End Element -->
  293. <!-- Start Element -->
  294. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  295. <tr><td>&nbsp;</td></tr>
  296. <tr><td bgcolor="#828DA6">
  297. <font color="#ffffff" face="arial,helvetica.sanserif" size="-1">
  298. <strong>propertyset</strong> (org.apache.tools.ant.types.PropertySet)</font>
  299. </td></tr>
  300. <tr><td><blockquote>
  301. Corresponds to <code>&lt;ant&gt;</code>'s nested <code>&lt;propertyset&gt;</code> element.
  302. <short-description><![CDATA[Corresponds to <code>&lt;ant&gt;</code>'s nested <code>&lt;propertyset&gt;</code> element.]]></short-description>
  303. <description>
  304. <![CDATA[Corresponds to <code>&lt;ant&gt;</code>'s nested <code>&lt;propertyset&gt;</code> element.]]>
  305. </description>
  306. </blockquote></td></tr>
  307. </table>
  308. <!-- End Element -->
  309. <!-- Start Element -->
  310. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  311. <tr><td>&nbsp;</td></tr>
  312. <tr><td bgcolor="#828DA6">
  313. <font color="#ffffff" face="arial,helvetica.sanserif" size="-1">
  314. <strong>reference</strong> (org.apache.tools.ant.taskdefs.Ant.Reference)</font>
  315. </td></tr>
  316. <tr><td><blockquote>
  317. Corresponds to <code>&lt;ant&gt;</code>'s nested <code>&lt;reference&gt;</code> element.
  318. <short-description><![CDATA[Corresponds to <code>&lt;ant&gt;</code>'s nested <code>&lt;reference&gt;</code> element.]]></short-description>
  319. <description>
  320. <![CDATA[Corresponds to <code>&lt;ant&gt;</code>'s nested <code>&lt;reference&gt;</code> element.]]>
  321. </description>
  322. </blockquote></td></tr>
  323. </table>
  324. <!-- End Element -->
  325. <!-- Start Element -->
  326. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  327. <tr><td>&nbsp;</td></tr>
  328. <tr><td bgcolor="#828DA6">
  329. <font color="#ffffff" face="arial,helvetica.sanserif" size="-1">
  330. <strong>buildpath</strong> (org.apache.tools.ant.types.Path)</font>
  331. </td></tr>
  332. <tr><td><blockquote>
  333. Creates a nested build path, and add it to the implicit build path.
  334. <short-description><![CDATA[Creates a nested build path, and add it to the implicit build path.]]></short-description>
  335. <description>
  336. <![CDATA[Creates a nested build path, and add it to the implicit build path.]]>
  337. </description>
  338. </blockquote></td></tr>
  339. </table>
  340. <!-- End Element -->
  341. <!-- Start Element -->
  342. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  343. <tr><td>&nbsp;</td></tr>
  344. <tr><td bgcolor="#828DA6">
  345. <font color="#ffffff" face="arial,helvetica.sanserif" size="-1">
  346. <strong>buildpathelement</strong> (org.apache.tools.ant.types.Path.PathElement)</font>
  347. </td></tr>
  348. <tr><td><blockquote>
  349. Creates a nested <code>&lt;buildpathelement&gt;</code>, and add it to the implicit build path.
  350. <short-description><![CDATA[Creates a nested <code>&lt;buildpathelement&gt;</code>, and add it to the implicit build path.]]></short-description>
  351. <description>
  352. <![CDATA[Creates a nested <code>&lt;buildpathelement&gt;</code>, and add it to the implicit build path.]]>
  353. </description>
  354. </blockquote></td></tr>
  355. </table>
  356. <!-- End Element -->
  357. </blockquote></td></tr>
  358. </table>
  359. <!-- End Elements -->
  360. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  361. <tr><td>&nbsp;</td></tr>
  362. <tr><td bgcolor="#525D76">
  363. <font color="#ffffff" face="arial,helvetica.sanserif">
  364. <a name="examples">
  365. <strong>Examples</strong></a></font>
  366. </td></tr>
  367. <tr><td><blockquote>
  368. <pre>
  369. &lt;project name="subant" default="subant1"&gt;
  370. &lt;property name="build.dir" value="subant.build"/&gt;
  371. &lt;target name="subant1"&gt;
  372. &lt;subant target=""&gt;
  373. &lt;property name="build.dir" value="subant1.build"/&gt;
  374. &lt;property name="not.overloaded" value="not.overloaded"/&gt;
  375. &lt;fileset dir="." includes="*/build.xml"/&gt;
  376. &lt;/subant&gt;
  377. &lt;/target&gt;
  378. &lt;/project&gt;
  379. </pre>
  380. <p>
  381. this snippet build file will run ant in each subdirectory of the project directory,
  382. where a file called build.xml can be found.
  383. The property build.dir will have the value subant1.build in the ant projects called by subant.
  384. </p>
  385. <pre>
  386. &lt;subant target=""&gt;
  387. &lt;propertyset&gt;
  388. &lt;propertyref prefix="toplevel"/&gt;
  389. &lt;mapper type="glob" from="foo*" to="bar*"/&gt;
  390. &lt;/propertyset&gt;
  391. &lt;fileset dir="." includes="*/build.xml"/&gt;
  392. &lt;/subant&gt;
  393. </pre>
  394. <p>
  395. this snippet build file will run ant in each subdirectory of the project directory,
  396. where a file called build.xml can be found.
  397. All properties whose name starts with "foo" are passed, their names are changed to start with "bar" instead
  398. </p>
  399. <pre>
  400. &lt;subant target="compile" genericantfile="/opt/project/build1.xml"&gt;
  401. &lt;dirset dir="." includes="projects*"/&gt;
  402. &lt;/subant&gt;
  403. </pre>
  404. <p>
  405. assuming the subdirs of the project dir are called projects1, projects2, projects3
  406. this snippet will execute the compile target of /opt/project/build1.xml,
  407. setting the basedir to projects1, projects2, projects3
  408. </p>
  409. </blockquote></td></tr>
  410. </table>
  411. </td>
  412. </tr>
  413. <!-- END RIGHT SIDE MAIN BODY -->
  414. <!-- FOOTER SEPARATOR -->
  415. <tr>
  416. <td>
  417. <hr noshade="" size="1"/>
  418. </td>
  419. </tr>
  420. <!-- PAGE FOOTER -->
  421. <tr>
  422. <td>
  423. <div align="center"><font color="#525D76" size="-1"><em>
  424. Copyright &#169; 2000-2003, Apache Software Foundation
  425. </em></font></div>
  426. </td>
  427. </tr>
  428. </table>
  429. </body>
  430. </html>