Name
antcall
Synopsis
Invokes a target in the current buildfile. Properties are passed to
the new target using nested <param>
elements. An investigation of the Ant source code reveals that
antcall
instantiates and calls the
ant
task using the current buildfile. This means
that a new project instance is created and properties work the same
as they do for ant
.
Attributes
-
inheritall
(1.4, boolean, N) Defines how properties are propagated to the new target. Defaults to
true
, meaning all properties in the current build process are inherited by the new target. Prior to Ant 1.4, this was the only behavior. Whenfalse
, properties set by users on the command line are the only ones passed to the new target.-
target
(all, String, Y) The name of the target to call.
Content
- 0..n nested
<param>
elements (all) Passes a property to the new build process. Each
<param>
element is implemented using the same class as theproperty
task; allproperty
attributes are applicable.
Example Usage
Call the cleandir
target and specify the
dir-to-clean
property:
<target name="clean"><antcall target="cleandir">
<param name="dir-to-clean" value="javadocs"/>
</antcall>
</target>
Delete a directory specified by the dir-to-clean
property:
<target name="cleandir"> <delete dir="${dir-to-clean}"/> </target>
See Also
See the property task for allowable attributes on
nested <param>
elements.
Get Ant: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.