Class CallTarget

All Implemented Interfaces:
Cloneable

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
  • Constructor Details

    • CallTarget

      public CallTarget()
  • Method Details

    • 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.
    • init

      public void init()
      Initialize this task by creating new instance of the ant task and configuring it by calling its own init method.
      Overrides:
      init in class Task
    • execute

      public void execute() throws BuildException
      Delegate the work to the ant task instance, after setting it up.
      Overrides:
      execute in class Task
      Throws:
      BuildException - on validation failure or if the target didn't execute.
    • createParam

      public Property createParam()
      Create a new Property to pass to the invoked target(s).
      Returns:
      a Property object.
    • 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
    • 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
    • setTarget

      public void setTarget(String target)
      Set target to execute.
      Parameters:
      target - the name of the target to execute.
    • 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
    • handleOutput

      public void handleOutput(String output)
      Handles output. Send it the the new project if is present, otherwise call the super class.
      Overrides:
      handleOutput in class Task
      Parameters:
      output - The string output to output.
      Since:
      Ant 1.5
      See Also:
    • handleInput

      public int handleInput(byte[] buffer, int offset, int length) throws IOException
      Handles input. Delegate to the created project, if present, otherwise call the super class.
      Overrides:
      handleInput in class Task
      Parameters:
      buffer - the buffer into which data is to be read.
      offset - the offset into the buffer at which data is stored.
      length - the amount of data to read.
      Returns:
      the number of bytes read.
      Throws:
      IOException - if the data cannot be read.
      Since:
      Ant 1.6
      See Also:
    • handleFlush

      public void handleFlush(String output)
      Handles output. Send it the the new project if is present, otherwise call the super class.
      Overrides:
      handleFlush in class Task
      Parameters:
      output - The string to output.
      Since:
      Ant 1.5.2
      See Also:
    • handleErrorOutput

      public void handleErrorOutput(String output)
      Handle error output. Send it the the new project if is present, otherwise call the super class.
      Overrides:
      handleErrorOutput in class Task
      Parameters:
      output - The string to output.
      Since:
      Ant 1.5
      See Also:
    • handleErrorFlush

      public void handleErrorFlush(String output)
      Handle error output. Send it the the new project if is present, otherwise call the super class.
      Overrides:
      handleErrorFlush in class Task
      Parameters:
      output - The string to output.
      Since:
      Ant 1.5.2
      See Also: