source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/docs/manual/using.html@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

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