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 19 KiB

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