diff --git a/docs/manual/CoreTasks/antcall.html b/docs/manual/CoreTasks/antcall.html index d3057eae4..50cdecbc8 100644 --- a/docs/manual/CoreTasks/antcall.html +++ b/docs/manual/CoreTasks/antcall.html @@ -11,6 +11,16 @@

Description

Call another target within the same build-file optionally specifying some properties (param's in this context)

+

By default, all of the properties of the current project will be +available in the new project. Alternatively, you can +set the inheritAll attribute to false and only +"user" properties (i.e., those passed on the command-line) +will be passed to the new project. In either case, the set of +properties passed to the new project will override the properties that +are set in the new project (See also the property task).

+

You can also set properties in the new project from the old project by +using nested param tags. These properties are always passed regardless of the +setting of inheritAll. This allows you to parameterize your subprojects.

Parameters

@@ -23,6 +33,13 @@ properties (param's in this context)

+ + + + +
The target to execute. Yes
inheritAllIf true, pass all properties to the new Ant + project. Defaults to true. + No

Parameters specified as nested elements

param

diff --git a/src/main/org/apache/tools/ant/taskdefs/CallTarget.java b/src/main/org/apache/tools/ant/taskdefs/CallTarget.java index a9346a778..71b180e27 100644 --- a/src/main/org/apache/tools/ant/taskdefs/CallTarget.java +++ b/src/main/org/apache/tools/ant/taskdefs/CallTarget.java @@ -83,6 +83,16 @@ public class CallTarget extends Task { private Ant callee; private String subTarget; private boolean initialized = false; + private boolean inheritAll = true; + + /** + * If true, inherit all properties from parent Project + * If false, inherit only userProperties and those defined + * inside the antcall call itself + **/ + public void setInheritAll(boolean inherit) { + inheritAll = inherit; + } //-- setInheritAll public void init() { callee = (Ant) project.createTask("ant"); @@ -106,6 +116,7 @@ public class CallTarget extends Task { callee.setDir(project.getBaseDir()); callee.setAntfile(project.getProperty("ant.file")); callee.setTarget(subTarget); + callee.setInheritAll(inheritAll); callee.execute(); }