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