org.apache.tools.ant.taskdefs

Class CallTarget

public class CallTarget extends Task

Call another target in the same project.
    <target name="foo">
      <antcall target="bar">
        <param name="property1" value="aaaaa" />
        <param name="foo" value="baz" />
       </antcall>
    </target>

    <target name="bar" depends="init">
      <echo message="prop is ${property1} ${foo}" />
    </target>
 

This only works as expected if neither property1 nor foo are defined in the project itself.

Since: Ant 1.2

UNKNOWN: name="antcall" category="control"

Method Summary
voidaddConfiguredTarget(Ant.TargetElement t)
Add a target to the list of targets to invoke.
voidaddPropertyset(PropertySet ps)
Set of properties to pass to the new project.
voidaddReference(Ant.Reference r)
Reference element identifying a data type to carry over to the invoked target.
PropertycreateParam()
Create a new Property to pass to the invoked target(s).
voidexecute()
Delegate the work to the ant task instance, after setting it up.
voidhandleErrorFlush(String output)
voidhandleErrorOutput(String output)
voidhandleFlush(String output)
inthandleInput(byte[] buffer, int offset, int length)
voidhandleOutput(String output)
voidinit()
Initialize this task by creating new instance of the ant task and configuring it by calling its own init method.
voidsetInheritAll(boolean inherit)
If true, pass all properties to the new Ant project.
voidsetInheritRefs(boolean inheritRefs)
If true, pass all references to the new Ant project.
voidsetTarget(String target)
Set target to execute.

Method Detail

addConfiguredTarget

public void addConfiguredTarget(Ant.TargetElement t)
Add a target to the list of targets to invoke.

Parameters: t Ant.TargetElement representing the target.

Since: Ant 1.6.3

addPropertyset

public void addPropertyset(PropertySet ps)
Set of properties to pass to the new project.

Parameters: ps the PropertySet to pass.

Since: Ant 1.6

addReference

public void addReference(Ant.Reference r)
Reference element identifying a data type to carry over to the invoked target.

Parameters: r the specified Ant.Reference.

Since: Ant 1.5

createParam

public Property createParam()
Create a new Property to pass to the invoked target(s).

Returns: a Property object.

execute

public void execute()
Delegate the work to the ant task instance, after setting it up.

Throws: BuildException on validation failure or if the target didn't execute.

handleErrorFlush

public void handleErrorFlush(String output)

Since: Ant 1.5.2

See Also:

handleErrorOutput

public void handleErrorOutput(String output)

Since: Ant 1.5

See Also:

handleFlush

public void handleFlush(String output)

Since: Ant 1.5.2

See Also:

handleInput

public int handleInput(byte[] buffer, int offset, int length)

Since: Ant 1.6

See Also: (byte[], int, int)

handleOutput

public void handleOutput(String output)

Since: Ant 1.5

See Also:

init

public void init()
Initialize this task by creating new instance of the ant task and configuring it by calling its own init method.

setInheritAll

public void setInheritAll(boolean inherit)
If true, pass all properties to the new Ant project. Defaults to true.

Parameters: inherit boolean flag.

setInheritRefs

public void setInheritRefs(boolean inheritRefs)
If true, pass all references to the new Ant project. Defaults to false.

Parameters: inheritRefs boolean flag.

setTarget

public void setTarget(String target)
Set target to execute.

Parameters: target the name of the target to execute.

Copyright