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.

using.html 21 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Writing a Simple Buildfile</title>
  5. </head>
  6. <body>
  7. <h1>Using Ant</h1>
  8. <h2><a name="buildfile">Writing a Simple Buildfile</a></h2>
  9. <p>Ant's buildfiles are written in XML. Each buildfile contains one project
  10. and at least one (default) target. Targets contain task elements.
  11. Each task element of the buildfile can have an <code>id</code> attribute and
  12. can later be referred to by the value supplied to this. The value has
  13. to be unique. (For additional information, see the
  14. <a href="#tasks"> Tasks</a> section below.)</p>
  15. <h3><a name="projects">Projects</a></h3>
  16. <p>A <i>project</i> has three attributes:</p>
  17. <table border="1" cellpadding="2" cellspacing="0">
  18. <tr>
  19. <td valign="top"><b>Attribute</b></td>
  20. <td valign="top"><b>Description</b></td>
  21. <td align="center" valign="top"><b>Required</b></td>
  22. </tr>
  23. <tr>
  24. <td valign="top">name</td>
  25. <td valign="top">the name of the project.</td>
  26. <td align="center" valign="top">No</td>
  27. </tr>
  28. <tr>
  29. <td valign="top">default</td>
  30. <td valign="top">the default target to use when no target is supplied.</td>
  31. <td align="center" valign="top">Yes</td>
  32. </tr>
  33. <tr>
  34. <td valign="top">basedir</td>
  35. <td valign="top">the base directory from which all path calculations are
  36. done. This attribute might be overridden by setting
  37. the &quot;basedir&quot;
  38. property beforehand. When this is done, it must be omitted in the
  39. project tag. If neither the attribute nor the property have
  40. been set, the parent directory of the buildfile will be used.</td>
  41. <td align="center" valign="top">No</td>
  42. </tr>
  43. </table>
  44. <p>Optionally, a description for the project can be provided as a
  45. top-level <code>&lt;description&gt;</code> element (see the <a
  46. href="CoreTypes/description.html">description</a> type).</p>
  47. <p>Each project defines one or more <i>targets</i>.
  48. A target is a set of <i>tasks</i> you want
  49. to be executed. When starting Ant, you can select which target(s) you
  50. want to have executed. When no target is given,
  51. the project's default is used.</p>
  52. <h3><a name="targets">Targets</a></h3>
  53. <p>A target can depend on other targets. You might have a target for compiling,
  54. for example, and a target for creating a distributable. You can only build a
  55. distributable when you have compiled first, so the distribute target
  56. <i>depends on</i> the compile target. Ant resolves these dependencies.</p>
  57. <p>It should be noted, however, that Ant's <code>depends</code> attribute
  58. only specifies the <i>order</i> in which targets should be executed - it
  59. does not affect whether the target that specifies the dependency(s) gets
  60. executed if the dependent target(s) did not (need to) run.
  61. </p>
  62. <p>Ant tries to execute the targets in the <code>depends</code>
  63. attribute in the order
  64. they appear (from left to right). Keep in mind that it is possible that a target
  65. can get executed earlier when an earlier target depends on it:</p>
  66. <blockquote>
  67. <pre>&lt;target name=&quot;A&quot;/&gt;
  68. &lt;target name=&quot;B&quot; depends=&quot;A&quot;/&gt;
  69. &lt;target name=&quot;C&quot; depends=&quot;B&quot;/&gt;
  70. &lt;target name=&quot;D&quot; depends=&quot;C,B,A&quot;/&gt;</pre>
  71. </blockquote>
  72. <p>Suppose we want to execute target D. From its
  73. <code>depends</code> attribute, you
  74. might think that first target C, then B and then A is executed.
  75. Wrong! C depends on B, and B depends on A, so first A is executed, then B, then C, and finally D.</p>
  76. <p>A target gets executed only once, even when more than one target
  77. depends on it (see the previous example).</p>
  78. <p>A target also has the ability to perform its execution if (or
  79. unless) a property has been set. This allows, for example, better
  80. control on the building process depending on the state of the system
  81. (java version, OS, command-line property defines, etc.). To make a target
  82. <i>sense</i> this property, you should add the <code>if</code> (or
  83. <code>unless</code>) attribute with the name of the property that the target
  84. should react to. For example:</p>
  85. <blockquote>
  86. <pre>&lt;target name=&quot;build-module-A&quot; if=&quot;module-A-present&quot;/&gt;</pre>
  87. <pre>&lt;target name=&quot;build-own-fake-module-A&quot; unless=&quot;module-A-present&quot;/&gt;</pre>
  88. </blockquote>
  89. <p>In the first example, if the <code>module-A-present</code>
  90. property is set (to any value), the target will be run. In the second
  91. example, if the <code>module-A-present</code> property is set
  92. (again, to any value), the target will not be run.
  93. </p>
  94. <p>If no <code>if</code> and no <code>unless</code> attribute is present,
  95. the target will always be executed.</p>
  96. <p>The optional <code>description</code> attribute can be used to provide a one-line description of this target, which is printed by the
  97. <nobr><code>-projecthelp</code></nobr> command-line option. Targets
  98. without such a description are deemed internal and will not be listed,
  99. unless either the <nobr><code>-verbose</code></nobr> or
  100. <nobr><code>-debug</code></nobr> option is used.
  101. </p>
  102. <p>It is a good practice to place your <a
  103. href="CoreTasks/tstamp.html">tstamp</a> tasks in a so-called
  104. <i>initialization</i> target, on which
  105. all other targets depend. Make sure that target is always the first one in
  106. the depends list of the other targets. In this manual, most initialization targets
  107. have the name <code>&quot;init&quot;</code>.</p>
  108. <p>A target has the following attributes:</p>
  109. <table border="1" cellpadding="2" cellspacing="0">
  110. <tr>
  111. <td valign="top"><b>Attribute</b></td>
  112. <td valign="top"><b>Description</b></td>
  113. <td align="center" valign="top"><b>Required</b></td>
  114. </tr>
  115. <tr>
  116. <td valign="top">name</td>
  117. <td valign="top">the name of the target.</td>
  118. <td align="center" valign="top">Yes</td>
  119. </tr>
  120. <tr>
  121. <td valign="top">depends</td>
  122. <td valign="top">a comma-separated list of names of targets on which this
  123. target depends.</td>
  124. <td align="center" valign="top">No</td>
  125. </tr>
  126. <tr>
  127. <td valign="top">if</td>
  128. <td valign="top">the name of the property that must be set in order for this
  129. target to execute.</td>
  130. <td align="center" valign="top">No</td>
  131. </tr>
  132. <tr>
  133. <td valign="top">unless</td>
  134. <td valign="top">the name of the property that must not be set in order
  135. for this target to execute.</td>
  136. <td align="center" valign="top">No</td>
  137. </tr>
  138. <tr>
  139. <td valign="top">description</td>
  140. <td valign="top">a short description of this target's function.</td>
  141. <td align="center" valign="top">No</td>
  142. </tr>
  143. </table>
  144. </p>
  145. A target name can be any alphanumeric string valid in the encoding of the XML
  146. file. The empty string &quot;&quot; is in this set, as is
  147. comma &quot;,&quot; and space &quot; &quot;.
  148. Please avoid using these, as they will not be supported in future Ant versions
  149. because of all the confusion they cause. IDE support of unusual target names,
  150. or any target name containing spaces, varies with the IDE.
  151. <p>
  152. Targets beginning with a hyphen such as <code>&quot;-restart&quot;</code>
  153. are valid, and can be used
  154. to name targets that should not be called directly from the command line.
  155. <h3><a name="tasks">Tasks</a></h3>
  156. <p>A task is a piece of code that can be executed.</p>
  157. <p>A task can have multiple attributes (or arguments, if you prefer). The value
  158. of an attribute might contain references to a property. These references will be
  159. resolved before the task is executed.</p>
  160. <p>Tasks have a common structure:</p>
  161. <blockquote>
  162. <pre>&lt;<i>name</i> <i>attribute1</i>=&quot;<i>value1</i>&quot; <i>attribute2</i>=&quot;<i>value2</i>&quot; ... /&gt;</pre>
  163. </blockquote>
  164. <p>where <i>name</i> is the name of the task,
  165. <i>attributeN</i> is the attribute name, and
  166. <i>valueN</i> is the value for this attribute.</p>
  167. <p>There is a set of <a href="coretasklist.html" target="navFrame">built-in tasks</a>, along with a
  168. number of
  169. <a href="optionaltasklist.html" target="navFrame"> optional tasks</a>, but it is also very
  170. easy to <a href="develop.html#writingowntask">write your own</a>.</p>
  171. <p>All tasks share a task name attribute. The value of
  172. this attribute will be used in the logging messages generated by
  173. Ant.</p>
  174. Tasks can be assigned an <code>id</code> attribute:
  175. <blockquote>
  176. <pre>&lt;<i>taskname</i> id="<i>taskID</i>" ... /&gt;</pre>
  177. </blockquote>
  178. where <i>taskname</i> is the name of the task, and <i>taskID</i> is
  179. a unique identifier for this task.
  180. You can refer to the
  181. corresponding task object in scripts or other tasks via this name.
  182. For example, in scripts you could do:
  183. <blockquote>
  184. <pre>
  185. &lt;script ... &gt;
  186. task1.setFoo("bar");
  187. &lt;/script&gt;
  188. </pre>
  189. </blockquote>
  190. to set the <code>foo</code> attribute of this particular task instance.
  191. In another task (written in Java), you can access the instance via
  192. <code>project.getReference("task1")</code>.
  193. <p>
  194. Note<sup>1</sup>: If &quot;task1&quot; has not been run yet, then
  195. it has not been configured (ie., no attributes have been set), and if it is
  196. going to be configured later, anything you've done to the instance may
  197. be overwritten.
  198. </p>
  199. <p>
  200. Note<sup>2</sup>: Future versions of Ant will most likely <i>not</i>
  201. be backward-compatible with this behaviour, since there will likely be no
  202. task instances at all, only proxies.
  203. </p>
  204. <h3><a name="properties">Properties</a></h3>
  205. <p>A project can have a set of properties. These might be set in the buildfile
  206. by the <a href="CoreTasks/property.html">property</a> task, or might be set outside Ant. A
  207. property has a name and a value; the name is case-sensitive. Properties may be used in the value of
  208. task attributes. This is done by placing the property name between
  209. &quot;<code>${</code>&quot; and &quot;<code>}</code>&quot; in the
  210. attribute value. For example,
  211. if there is a &quot;builddir&quot; property with the value
  212. &quot;build&quot;, then this could be used in an attribute like this:
  213. <code>${builddir}/classes</code>.
  214. This is resolved at run-time as <code>build/classes</code>.</p>
  215. <h3><a name="built-in-props">Built-in Properties</a></h3>
  216. <p>Ant provides access to all system properties as if they had been
  217. defined using a <code>&lt;property&gt;</code> task.
  218. For example, <code>${os.name}</code> expands to the
  219. name of the operating system.</p>
  220. <p>For a list of system properties see
  221. <a href="http://java.sun.com/j2se/1.3/docs/api/java/lang/System.html#getProperties()">the Javadoc of System.getProperties</a>.
  222. </p>
  223. <p>In addition, Ant has some built-in properties:</p>
  224. <pre>
  225. basedir the absolute path of the project's basedir (as set
  226. with the basedir attribute of &lt;project&gt;).
  227. ant.file the absolute path of the buildfile.
  228. ant.version the version of Ant
  229. ant.project.name the name of the project that is currently executing;
  230. it is set in the name attribute of &lt;project&gt;.
  231. ant.java.version the JVM version Ant detected; currently it can hold
  232. the values &quot;1.1&quot;, &quot;1.2&quot;, &quot;1.3&quot; and &quot;1.4&quot;.
  233. </pre>
  234. <a name="example"><h3>Example Buildfile</h3></a>
  235. <pre>
  236. &lt;project name=&quot;MyProject&quot; default=&quot;dist&quot; basedir=&quot;.&quot;&gt;
  237. &lt;description&gt;
  238. simple example build file
  239. &lt;/description&gt;
  240. &lt;!-- set global properties for this build --&gt;
  241. &lt;property name=&quot;src&quot; location=&quot;src&quot;/&gt;
  242. &lt;property name=&quot;build&quot; location=&quot;build&quot;/&gt;
  243. &lt;property name=&quot;dist&quot; location=&quot;dist&quot;/&gt;
  244. &lt;target name=&quot;init&quot;&gt;
  245. &lt;!-- Create the time stamp --&gt;
  246. &lt;tstamp/&gt;
  247. &lt;!-- Create the build directory structure used by compile --&gt;
  248. &lt;mkdir dir=&quot;${build}&quot;/&gt;
  249. &lt;/target&gt;
  250. &lt;target name=&quot;compile&quot; depends=&quot;init&quot;
  251. description=&quot;compile the source &quot; &gt;
  252. &lt;!-- Compile the java code from ${src} into ${build} --&gt;
  253. &lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot;/&gt;
  254. &lt;/target&gt;
  255. &lt;target name=&quot;dist&quot; depends=&quot;compile&quot;
  256. description=&quot;generate the distribution&quot; &gt;
  257. &lt;!-- Create the distribution directory --&gt;
  258. &lt;mkdir dir=&quot;${dist}/lib&quot;/&gt;
  259. &lt;!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --&gt;
  260. &lt;jar jarfile=&quot;${dist}/lib/MyProject-${DSTAMP}.jar&quot; basedir=&quot;${build}&quot;/&gt;
  261. &lt;/target&gt;
  262. &lt;target name=&quot;clean&quot;
  263. description=&quot;clean up&quot; &gt;
  264. &lt;!-- Delete the ${build} and ${dist} directory trees --&gt;
  265. &lt;delete dir=&quot;${build}&quot;/&gt;
  266. &lt;delete dir=&quot;${dist}&quot;/&gt;
  267. &lt;/target&gt;
  268. &lt;/project&gt;
  269. </pre>
  270. Notice that we are declaring properties outside any target. The
  271. <tt>&lt;property&gt;</tt>,<tt>&lt;typedef&gt;</tt> and <tt>&lt;taskdef&gt;</tt>
  272. tasks are special in that they can be declared outside any target. When you
  273. do this they are evaluated before any targets are executed. No other tasks
  274. can be declared outside targets.
  275. <p>
  276. We have given some targets descriptions; this causes the <tt>projecthelp</tt>
  277. invocation option to list them as public targets with the descriptions; the
  278. other target is internal and not listed.
  279. <p>
  280. Finally, for this target to work the source in the <tt>src</tt> subdirectory
  281. should be stored in a directory tree which matches the package names. Check the
  282. <tt>&lt;javac&gt;</tt> task for details.
  283. <a name="filters"><h3>Token Filters</h3></a>
  284. <p>A project can have a set of tokens that might be automatically expanded if
  285. found when a file is copied, when the filtering-copy behavior is selected in the
  286. tasks that support this. These might be set in the buildfile
  287. by the <a href="CoreTasks/filter.html">filter</a> task.</p>
  288. <p>Since this can potentially be a very harmful behavior,
  289. the tokens in the files <b>must</b>
  290. be of the form <code>@</code><i>token</i><code>@</code>, where
  291. <i>token</i> is the token name that is set
  292. in the <code>&lt;filter&gt;</code> task. This token syntax matches the syntax of other build systems
  293. that perform such filtering and remains sufficiently orthogonal to most
  294. programming and scripting languages, as well as with documentation systems.</p>
  295. <p>Note: If a token with the format <code>@</code><i>token</i><code>@</code>
  296. is found in a file, but no
  297. filter is associated with that token, no changes take place;
  298. therefore, no escaping
  299. method is available - but as long as you choose appropriate names for your
  300. tokens, this should not cause problems.</p>
  301. <p><b>Warning:</b> If you copy binary files with filtering turned on, you can corrupt the
  302. files. This feature should be used with text files <em>only</em>.</p>
  303. <h3><a name="path">Path-like Structures</a></h3>
  304. <p>You can specify <code>PATH</code>- and <code>CLASSPATH</code>-type
  305. references using both
  306. &quot;<code>:</code>&quot; and &quot;<code>;</code>&quot; as separator
  307. characters. Ant will
  308. convert the separator to the correct character of the current operating
  309. system.</p>
  310. <p>Wherever path-like values need to be specified, a nested element can
  311. be used. This takes the general form of:</p>
  312. <pre>
  313. &lt;classpath&gt;
  314. &lt;pathelement path=&quot;${classpath}&quot;/&gt;
  315. &lt;pathelement location=&quot;lib/helper.jar&quot;/&gt;
  316. &lt;/classpath&gt;
  317. </pre>
  318. <p>The <code>location</code> attribute specifies a single file or
  319. directory relative to the project's base directory (or an absolute
  320. filename), while the <code>path</code> attribute accepts colon-
  321. or semicolon-separated lists of locations. The <code>path</code>
  322. attribute is intended to be used with predefined paths - in any other
  323. case, multiple elements with <code>location</code> attributes should be
  324. preferred.</p>
  325. <p>As a shortcut, the <code>&lt;classpath&gt;</code> tag
  326. supports <code>path</code> and
  327. <code>location</code> attributes of its own, so:</p>
  328. <pre>
  329. &lt;classpath&gt;
  330. &lt;pathelement path=&quot;${classpath}&quot;/&gt;
  331. &lt;/classpath&gt;
  332. </pre>
  333. <p>can be abbreviated to:</p>
  334. <pre>
  335. &lt;classpath path=&quot;${classpath}&quot;/&gt;
  336. </pre>
  337. <p>In addition, <a href="CoreTypes/fileset.html">FileSet</a>s can be specified via
  338. nested <code>&lt;fileset&gt;</code> elements. The order in which the files
  339. building up a fileset are added to the path-like structure is not
  340. defined.</p>
  341. <pre>
  342. &lt;classpath&gt;
  343. &lt;pathelement path=&quot;${classpath}&quot;/&gt;
  344. &lt;fileset dir=&quot;lib&quot;&gt;
  345. &lt;include name=&quot;**/*.jar&quot;/&gt;
  346. &lt;/fileset&gt;
  347. &lt;pathelement location=&quot;classes&quot;/&gt;
  348. &lt;/classpath&gt;
  349. </pre>
  350. <p>This builds a path that holds the value of <code>${classpath}</code>,
  351. followed by all jar files in the <code>lib</code> directory, followed
  352. by the <code>classes</code> directory.</p>
  353. <p>If you want to use the same path-like structure for several tasks,
  354. you can define them with a <code>&lt;path&gt;</code> element at the
  355. same level as <i>target</i>s, and reference them via their
  356. <i>id</i> attribute - see <a href="#references">References</a> for an
  357. example.</p>
  358. <p>A path-like structure can include a reference to another path-like
  359. structure via nested <code>&lt;path&gt;</code> elements:</p>
  360. <pre>
  361. &lt;path id=&quot;base.path&quot;&gt;
  362. &lt;pathelement path=&quot;${classpath}&quot;/&gt;
  363. &lt;fileset dir=&quot;lib&quot;&gt;
  364. &lt;include name=&quot;**/*.jar&quot;/&gt;
  365. &lt;/fileset&gt;
  366. &lt;pathelement location=&quot;classes&quot;/&gt;
  367. &lt;/path&gt;
  368. &lt;path id=&quot;tests.path&quot;&gt;
  369. &lt;path refid=&quot;base.path&quot;/&gt;
  370. &lt;pathelement location=&quot;testclasses&quot;/&gt;
  371. &lt;/path&gt;
  372. </pre>
  373. The shortcuts previously mentioned for <code>&lt;classpath&gt;</code> are also valid for <code>&lt;path&gt;</code>.For example:
  374. <pre>
  375. &lt;path id=&quot;base.path&quot;&gt;
  376. &lt;pathelement path=&quot;${classpath}&quot;/&gt;
  377. &lt;/path&gt;
  378. </pre>
  379. can be written as:
  380. <pre>
  381. &lt;path id=&quot;base.path&quot; path=&quot;${classpath}&quot;/&gt;
  382. </pre>
  383. <h3><a name="arg">Command-line Arguments</a></h3>
  384. <p>Several tasks take arguments that will be passed to another
  385. process on the command line. To make it easier to specify arguments
  386. that contain space characters, nested <code>arg</code> elements can be used.</p>
  387. <table border="1" cellpadding="2" cellspacing="0">
  388. <tr>
  389. <td width="12%" valign="top"><b>Attribute</b></td>
  390. <td width="78%" valign="top"><b>Description</b></td>
  391. <td width="10%" valign="top"><b>Required</b></td>
  392. </tr>
  393. <tr>
  394. <td valign="top">value</td>
  395. <td valign="top">a single command-line argument; can contain space
  396. characters.</td>
  397. <td align="center" rowspan="4">Exactly one of these.</td>
  398. </tr>
  399. <tr>
  400. <td valign="top">line</td>
  401. <td valign="top">a space-delimited list of command-line arguments.</td>
  402. </tr>
  403. <tr>
  404. <td valign="top">file</td>
  405. <td valign="top">The name of a file as a single command-line
  406. argument; will be replaced with the absolute filename of the file.</td>
  407. </tr>
  408. <tr>
  409. <td valign="top">path</td>
  410. <td valign="top">A string that will be treated as a path-like
  411. string as a single command-line argument; you can use <code>;</code>
  412. or <code>:</code> as
  413. path separators and Ant will convert it to the platform's local
  414. conventions.</td>
  415. </tr>
  416. </table>
  417. <h4>Examples</h4>
  418. <blockquote><pre>
  419. &lt;arg value=&quot;-l -a&quot;/&gt;
  420. </pre></blockquote>
  421. <p>is a single command-line argument containing a space character.</p>
  422. <blockquote><pre>
  423. &lt;arg line=&quot;-l -a&quot;/&gt;
  424. </pre></blockquote>
  425. <p>represents two separate command-line arguments.</p>
  426. <blockquote><pre>
  427. &lt;arg path=&quot;/dir;/dir2:\dir3&quot;/&gt;
  428. </pre></blockquote>
  429. <p>is a single command-line argument with the value
  430. <code>\dir;\dir2;\dir3</code> on DOS-based systems and
  431. <code>/dir:/dir2:/dir3</code> on Unix-like systems.</p>
  432. <h3><a name="references">References</a></h3>
  433. <p>The <code>id</code> attribute of the buildfile's elements can be
  434. used to refer to them. This can be useful if you are going to replicate
  435. the same snippet of XML over and over again - using a
  436. <code>&lt;classpath&gt;</code> structure more than once, for
  437. example.</p>
  438. <p>The following example:</p>
  439. <blockquote><pre>
  440. &lt;project ... &gt;
  441. &lt;target ... &gt;
  442. &lt;rmic ...&gt;
  443. &lt;classpath&gt;
  444. &lt;pathelement location=&quot;lib/&quot;/&gt;
  445. &lt;pathelement path=&quot;${java.class.path}/&quot;/&gt;
  446. &lt;pathelement path=&quot;${additional.path}&quot;/&gt;
  447. &lt;/classpath&gt;
  448. &lt;/rmic&gt;
  449. &lt;/target&gt;
  450. &lt;target ... &gt;
  451. &lt;javac ...&gt;
  452. &lt;classpath&gt;
  453. &lt;pathelement location=&quot;lib/&quot;/&gt;
  454. &lt;pathelement path=&quot;${java.class.path}/&quot;/&gt;
  455. &lt;pathelement path=&quot;${additional.path}&quot;/&gt;
  456. &lt;/classpath&gt;
  457. &lt;/javac&gt;
  458. &lt;/target&gt;
  459. &lt;/project&gt;
  460. </pre></blockquote>
  461. <p>could be rewritten as:</p>
  462. <blockquote><pre>
  463. &lt;project ... &gt;
  464. &lt;path id=&quot;project.class.path&quot;&gt;
  465. &lt;pathelement location=&quot;lib/&quot;/&gt;
  466. &lt;pathelement path=&quot;${java.class.path}/&quot;/&gt;
  467. &lt;pathelement path=&quot;${additional.path}&quot;/&gt;
  468. &lt;/path&gt;
  469. &lt;target ... &gt;
  470. &lt;rmic ...&gt;
  471. &lt;classpath refid=&quot;project.class.path&quot;/&gt;
  472. &lt;/rmic&gt;
  473. &lt;/target&gt;
  474. &lt;target ... &gt;
  475. &lt;javac ...&gt;
  476. &lt;classpath refid=&quot;project.class.path&quot;/&gt;
  477. &lt;/javac&gt;
  478. &lt;/target&gt;
  479. &lt;/project&gt;
  480. </pre></blockquote>
  481. <p>All tasks that use nested elements for <a
  482. href="CoreTypes/patternset.html">PatternSet</a>s, <a href="CoreTypes/fileset.html">FileSet</a>s or
  483. <a href="#path">path-like structures</a> accept references to these
  484. structures as well.</p>
  485. <hr>
  486. <p align="center">Copyright &copy; 2001-2002 Apache Software Foundation. All rights
  487. Reserved.</p>
  488. </body>
  489. </html>