2001-02-13 12:32:01 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2002-02-03 22:00:42 +00:00
|
|
|
<title>Ant Task</title>
|
2001-02-13 12:32:01 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h2><a name="ant">Ant</a></h2>
|
|
|
|
<h3>Description</h3>
|
2003-09-03 10:03:47 +00:00
|
|
|
|
|
|
|
<p>Runs Ant on a supplied buildfile. This can be used to build
|
2003-12-17 13:06:52 +00:00
|
|
|
subprojects. <strong>This task must not be used outside of a
|
2004-03-03 15:03:22 +00:00
|
|
|
<code>target</code> if it invokes the same build file it is part
|
2003-09-03 10:03:47 +00:00
|
|
|
of.</strong></p>
|
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<p>When the <i>antfile</i> attribute is omitted, the file "build.xml"
|
|
|
|
in the supplied directory (<i>dir</i> attribute) is used.</p>
|
|
|
|
<p>If no target attribute is supplied, the default target of the new project is
|
|
|
|
used.</p>
|
2001-07-10 13:23:29 +00:00
|
|
|
<p>By default, all of the properties of the current project will be
|
2003-09-25 13:48:42 +00:00
|
|
|
available in the new project. Alternatively, you can set the
|
|
|
|
<i>inheritAll</i> attribute to <code>false</code> and only
|
2001-07-10 13:23:29 +00:00
|
|
|
"user" properties (i.e., those passed on the command-line)
|
|
|
|
will be passed to the new project. In either case, the set of
|
2003-09-25 13:48:42 +00:00
|
|
|
properties passed to the new project will override the properties that
|
|
|
|
are set in the new project (See also the <a
|
|
|
|
href="property.html">property task</a>).</p>
|
|
|
|
|
|
|
|
<p>You can also set properties in the new project from the old project
|
|
|
|
by using nested property tags. These properties are always passed
|
2003-11-24 16:12:40 +00:00
|
|
|
to the new project and any project created in that project
|
2003-09-25 13:48:42 +00:00
|
|
|
regardless of the setting of <i>inheritAll</i>. This allows you to
|
|
|
|
parameterize your subprojects. Properties defined on the command line
|
2004-12-01 04:02:33 +00:00
|
|
|
cannot be overridden by nested <code><property></code> elements.</p>
|
2001-12-10 10:10:35 +00:00
|
|
|
|
2001-12-13 11:56:25 +00:00
|
|
|
<p>References to data types can also be passed to the new project, but
|
|
|
|
by default they are not. If you set the inheritrefs attribute to
|
|
|
|
true, all references will be copied, but they will not override
|
|
|
|
references defined in the new project.</p>
|
|
|
|
|
2004-11-19 09:07:12 +00:00
|
|
|
<p>Nested <a href="#reference"><i><code><reference></code></i></a> elements
|
2001-12-13 11:56:25 +00:00
|
|
|
can also be used to copy references from the calling project to the
|
|
|
|
new project, optionally under a different id. References taken from
|
2003-10-14 12:14:24 +00:00
|
|
|
nested elements will override existing references that have been
|
|
|
|
defined outside of targets in the new project - but not those defined
|
|
|
|
inside of targets.</p>
|
2001-12-10 10:10:35 +00:00
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Parameters</h3>
|
|
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td valign="top"><b>Attribute</b></td>
|
|
|
|
<td valign="top"><b>Description</b></td>
|
|
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">antfile</td>
|
2001-10-29 09:33:27 +00:00
|
|
|
<td valign="top">the buildfile to use. Defaults to
|
|
|
|
"build.xml". This file is expected to be a filename
|
|
|
|
relative to the dir attribute given.</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">dir</td>
|
2003-12-17 13:06:52 +00:00
|
|
|
<td valign="top">the directory to use as a basedir for the new Ant project.
|
2001-10-29 09:33:27 +00:00
|
|
|
Defaults to the current project's basedir, unless
|
2001-10-29 09:38:48 +00:00
|
|
|
inheritall has been set to false, in which case it doesn't
|
2001-10-29 09:33:27 +00:00
|
|
|
have a default value. This will override the basedir
|
|
|
|
setting of the called project.</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">target</td>
|
2001-10-29 09:33:27 +00:00
|
|
|
<td valign="top">the target of the new Ant project that should be executed.
|
|
|
|
Defaults to the new project's default target.</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">output</td>
|
2002-04-10 10:02:54 +00:00
|
|
|
<td valign="top">Filename to write the ant output to. This is
|
|
|
|
relative to the value of the dir attribute if it has been set or
|
|
|
|
to the base directory of the current project otherwise.
|
2001-02-13 12:32:01 +00:00
|
|
|
</td>
|
|
|
|
<td align="center" valign="top">No</td>
|
|
|
|
</tr>
|
2001-07-10 13:23:29 +00:00
|
|
|
<tr>
|
2003-12-17 13:06:52 +00:00
|
|
|
<td valign="top">inheritAll</td>
|
2001-12-13 11:56:25 +00:00
|
|
|
<td valign="top">If <code>true</code>, pass all properties to the
|
|
|
|
new Ant project. Defaults to <code>true</code>.</td>
|
|
|
|
<td align="center" valign="top">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2003-12-17 13:06:52 +00:00
|
|
|
<td valign="top">inheritRefs</td>
|
2001-12-13 11:56:25 +00:00
|
|
|
<td valign="top">If <code>true</code>, pass all references to the
|
|
|
|
new Ant project. Defaults to <code>false</code>.</td>
|
2001-07-10 13:23:29 +00:00
|
|
|
<td align="center" valign="top">No</td>
|
|
|
|
</tr>
|
2001-02-13 12:32:01 +00:00
|
|
|
</table>
|
2001-10-30 08:42:14 +00:00
|
|
|
|
2003-05-12 15:19:18 +00:00
|
|
|
<h3>Parameters specified as nested elements</h3>
|
|
|
|
|
|
|
|
<h4>property</h4>
|
2002-06-01 12:26:43 +00:00
|
|
|
<p>See the description of the <a href="property.html">property
|
2005-04-29 18:58:16 +00:00
|
|
|
task</a>. <br>
|
2004-08-11 09:12:37 +00:00
|
|
|
These properties become equivalent to properties you define on
|
|
|
|
the command line. These are special properties and they will always get passed
|
2004-11-19 09:07:12 +00:00
|
|
|
down, even through additional <code><*ant*></code> tasks with inheritall set to
|
2005-04-29 18:58:16 +00:00
|
|
|
false (see above). <br>
|
2004-08-11 09:12:37 +00:00
|
|
|
Note that the <code>refid</code> attribute points to a
|
2002-06-01 12:26:43 +00:00
|
|
|
reference in the calling project, not in the new one.</p>
|
2001-12-10 10:10:35 +00:00
|
|
|
|
2001-12-13 11:56:25 +00:00
|
|
|
<h4><a name="reference">reference</a></h4>
|
2003-12-17 13:06:52 +00:00
|
|
|
<p>Used to choose references that shall be copied into the new project,
|
2001-12-10 10:10:35 +00:00
|
|
|
optionally changing their id.</p>
|
|
|
|
|
|
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td valign="top"><b>Attribute</b></td>
|
|
|
|
<td valign="top"><b>Description</b></td>
|
|
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">refid</td>
|
|
|
|
<td valign="top">The id of the reference in the calling project.</td>
|
|
|
|
<td valign="top" align="center">Yes</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2002-02-28 07:58:46 +00:00
|
|
|
<td valign="top">torefid</td>
|
2001-12-10 10:10:35 +00:00
|
|
|
<td valign="top">The id of the reference in the new project.</td>
|
|
|
|
<td valign="top" align="center">No, defaults to the value of refid.</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2003-05-12 15:19:18 +00:00
|
|
|
<h4>propertyset</h4>
|
|
|
|
|
|
|
|
<p>You can specify a set of properties to be copied into the new
|
|
|
|
project with <a
|
|
|
|
href="../CoreTypes/propertyset.html">propertyset</a>s.</p>
|
|
|
|
|
|
|
|
<p><em>since Ant 1.6</em>.</p>
|
|
|
|
|
2004-06-24 19:30:03 +00:00
|
|
|
<h4>target</h4>
|
|
|
|
|
2004-11-19 09:07:12 +00:00
|
|
|
<p>You can specify multiple targets using nested <code><target></code> elements
|
2004-06-24 19:30:03 +00:00
|
|
|
instead of using the target attribute. These will be executed as if
|
|
|
|
Ant had been invoked with a single target whose dependencies are the
|
|
|
|
targets so specified, in the order specified.</p>
|
|
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td valign="top"><b>Attribute</b></td>
|
|
|
|
<td valign="top"><b>Description</b></td>
|
|
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">name</td>
|
|
|
|
<td valign="top">The name of the called target.</td>
|
|
|
|
<td valign="top" align="center">Yes</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2004-12-14 21:19:28 +00:00
|
|
|
<p><em>since Ant 1.6.3</em>.</p>
|
2004-06-24 19:30:03 +00:00
|
|
|
|
2001-12-10 10:10:35 +00:00
|
|
|
<h3>Basedir of the new project</h3>
|
2001-10-30 08:42:14 +00:00
|
|
|
|
|
|
|
<p>The basedir value of the new project is affected by the two
|
|
|
|
attributes dir and inheritall, see the following table for
|
|
|
|
details:</p>
|
|
|
|
|
|
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td valign="top"><b>dir attribute</b></td>
|
|
|
|
<td valign="top"><b>inheritAll attribute</b></td>
|
|
|
|
<td valign="top"><b>new project's basedir</b></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">value provided</td>
|
|
|
|
<td valign="top">true</td>
|
|
|
|
<td valign="top">value of dir attribute</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">value provided</td>
|
|
|
|
<td valign="top">false</td>
|
|
|
|
<td valign="top">value of dir attribute</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">omitted</td>
|
|
|
|
<td valign="top">true</td>
|
|
|
|
<td valign="top">basedir of calling project (the one whose build
|
2004-11-19 09:07:12 +00:00
|
|
|
file contains the <code><ant></code> task).</td>
|
2001-10-30 08:42:14 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">omitted</td>
|
|
|
|
<td valign="top">false</td>
|
2004-11-19 09:07:12 +00:00
|
|
|
<td valign="top">basedir attribute of the <code><project></code> element
|
2001-10-30 08:42:14 +00:00
|
|
|
of the new project</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Examples</h3>
|
2005-03-08 18:17:40 +00:00
|
|
|
<blockquote><pre>
|
2006-02-14 15:30:28 +00:00
|
|
|
<ant antfile="subproject/subbuild.xml" target="compile"/>
|
2001-02-13 12:32:01 +00:00
|
|
|
|
2005-03-08 18:17:40 +00:00
|
|
|
<ant dir="subproject"/>
|
2001-02-13 12:32:01 +00:00
|
|
|
|
2005-03-08 18:17:40 +00:00
|
|
|
<ant antfile="subproject/property_based_subbuild.xml">
|
|
|
|
<property name="param1" value="version 1.x"/>
|
|
|
|
<property file="config/subproject/default.properties"/>
|
|
|
|
</ant>
|
2001-12-10 10:10:35 +00:00
|
|
|
|
2005-03-08 18:17:40 +00:00
|
|
|
<ant inheritAll="false" antfile="subproject/subbuild.xml">
|
|
|
|
<property name="output.type" value="html"/>
|
|
|
|
</ant>
|
|
|
|
</pre></blockquote>
|
2006-02-14 15:30:28 +00:00
|
|
|
|
|
|
|
<p>These lines invoke the same build file:</p>
|
|
|
|
<blockquote><pre>
|
|
|
|
<ant antfile="sub1/sub2/build.xml" />
|
|
|
|
<ant antfile="sub2/build.xml" dir="sub1" />
|
|
|
|
<ant antfile="build.xml" dir="sub1/sub2" />
|
|
|
|
</pre></blockquote>
|
|
|
|
|
2001-12-10 10:10:35 +00:00
|
|
|
<p>The build file of the calling project defines some
|
|
|
|
<code><path></code> elements like this:</p>
|
|
|
|
|
2005-03-08 18:17:40 +00:00
|
|
|
<blockquote><pre>
|
|
|
|
<path id="path1">
|
2001-12-10 10:10:35 +00:00
|
|
|
...
|
2005-03-08 18:17:40 +00:00
|
|
|
</path>
|
|
|
|
<path id="path2">
|
2001-12-10 10:10:35 +00:00
|
|
|
...
|
2005-03-08 18:17:40 +00:00
|
|
|
</path>
|
|
|
|
</pre></blockquote>
|
2001-12-10 10:10:35 +00:00
|
|
|
|
|
|
|
<p>and the called build file (<code>subbuild.xml</code>) also defines
|
|
|
|
a <code><path></code> with the id <code>path1</code>, but
|
|
|
|
<code>path2</code> is not defined:</p>
|
|
|
|
|
2005-03-08 18:17:40 +00:00
|
|
|
<blockquote><pre>
|
|
|
|
<ant antfile="subbuild.xml" inheritrefs="true"/>
|
|
|
|
</pre></blockquote>
|
2001-12-10 10:10:35 +00:00
|
|
|
|
|
|
|
<p>will not override <code>subbuild</code>'s definition of
|
|
|
|
<code>path1</code>, but make the parent's definition of
|
2001-12-13 11:56:25 +00:00
|
|
|
<code>path2</code> available in the subbuild.</p>
|
2001-12-10 10:10:35 +00:00
|
|
|
|
2005-03-08 18:17:40 +00:00
|
|
|
<blockquote><pre>
|
|
|
|
<ant antfile="subbuild.xml"/>
|
|
|
|
</pre></blockquote>
|
2001-12-10 10:10:35 +00:00
|
|
|
|
2001-12-13 11:56:25 +00:00
|
|
|
<p>as well as</p>
|
|
|
|
|
2005-03-08 18:17:40 +00:00
|
|
|
<blockquote><pre>
|
|
|
|
<ant antfile="subbuild.xml" inheritrefs="false"/>
|
|
|
|
</pre></blockquote>
|
2001-12-10 10:10:35 +00:00
|
|
|
|
|
|
|
<p>will neither override <code>path1</code> nor copy
|
|
|
|
<code>path2</code>.</p>
|
|
|
|
|
2005-03-08 18:17:40 +00:00
|
|
|
<blockquote><pre>
|
|
|
|
<ant antfile="subbuild.xml" inheritrefs="false">
|
|
|
|
<reference refid="path1"/>
|
|
|
|
</ant>
|
|
|
|
</pre></blockquote>
|
2001-12-10 10:10:35 +00:00
|
|
|
|
|
|
|
<p>will override <code>subbuild</code>'s definition of
|
|
|
|
<code>path1</code>.</p>
|
|
|
|
|
2005-03-08 18:17:40 +00:00
|
|
|
<blockquote><pre>
|
|
|
|
<ant antfile="subbuild.xml" inheritrefs="false">
|
|
|
|
<reference refid="path1" torefid="path2"/>
|
|
|
|
</ant>
|
|
|
|
</pre></blockquote>
|
2001-12-10 10:10:35 +00:00
|
|
|
|
|
|
|
<p>will copy the parent's definition of <code>path1</code> into the
|
|
|
|
new project using the id <code>path2</code>.</p>
|
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<hr>
|
2006-02-14 15:30:28 +00:00
|
|
|
<p align="center">Copyright © 2000-2006 The Apache Software Foundation. All rights
|
2001-02-13 12:32:01 +00:00
|
|
|
Reserved.</p>
|
|
|
|
|
|
|
|
</body>
|
2006-02-14 15:30:28 +00:00
|
|
|
</html>
|