Class CallTarget
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.CallTarget
- All Implemented Interfaces:
Cloneable
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
-
Field Summary
Fields inherited from class ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a target to the list of targets to invoke.voidSet of properties to pass to the new project.voidReference element identifying a data type to carry over to the invoked target.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) Handle error output.voidhandleErrorOutput(String output) Handle error output.voidhandleFlush(String output) Handles output.inthandleInput(byte[] buffer, int offset, int length) Handles input.voidhandleOutput(String output) Handles 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.voidSet target to execute.Methods inherited from class Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeModifier and TypeMethodDescriptionfinal voidbindToOwner(Task owner) Bind a task to another; use this when configuring a newly created task to do work on behalf of another.Returns the container target of this task.Returns the wrapper used for runtime configuration.Returns the name to use in logging messages.Return the type of task.protected RuntimeConfigurableReturn the runtime configurable structure for this task.protected final booleanHas this task been marked invalid?voidLogs a message with the default (INFO) priority.voidLogs a message with the given priority.voidLogs a message with the given priority.voidLogs a message with the given priority.voidConfigures this task - if it hasn't been done already.final voidperform()Performs this task if it's still valid, or gets a replacement version and performs that otherwise.voidForce the task to be reconfigured from its RuntimeConfigurable.voidsetOwningTarget(Target target) Sets the target container of this task.voidSets the wrapper to be used for runtime configuration.voidsetTaskName(String name) Sets the name to use in logging messages.voidsetTaskType(String type) Sets the name with which the task has been invoked.Methods inherited from class ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProjectModifier and TypeMethodDescriptionclone()Returns the description of the current action.Returns the file/location where this task was defined.Returns the project to which this component belongs.voidsetDescription(String desc) Sets a description of the current action.voidsetLocation(Location location) Sets the file/location where this task was defined.voidsetProject(Project project) Sets the project object of this component.
-
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-booleanflag.
-
setInheritRefs
public void setInheritRefs(boolean inheritRefs) If true, pass all references to the new Ant project. Defaults to false.- Parameters:
inheritRefs-booleanflag.
-
init
-
execute
Delegate the work to the ant task instance, after setting it up.- Overrides:
executein classTask- Throws:
BuildException- on validation failure or if the target didn't execute.
-
createParam
Create a new Property to pass to the invoked target(s).- Returns:
- a
Propertyobject.
-
addReference
Reference element identifying a data type to carry over to the invoked target.- Parameters:
r- the specifiedAnt.Reference.- Since:
- Ant 1.5
-
addPropertyset
Set of properties to pass to the new project.- Parameters:
ps- thePropertySetto pass.- Since:
- Ant 1.6
-
setTarget
Set target to execute.- Parameters:
target- the name of the target to execute.
-
addConfiguredTarget
Add a target to the list of targets to invoke.- Parameters:
t-Ant.TargetElementrepresenting the target.- Since:
- Ant 1.6.3
-
handleOutput
Handles output. Send it the the new project if is present, otherwise call the super class.- Overrides:
handleOutputin classTask- Parameters:
output- The string output to output.- Since:
- Ant 1.5
- See Also:
-
handleInput
Handles input. Delegate to the created project, if present, otherwise call the super class.- Overrides:
handleInputin classTask- 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
Handles output. Send it the the new project if is present, otherwise call the super class.- Overrides:
handleFlushin classTask- Parameters:
output- The string to output.- Since:
- Ant 1.5.2
- See Also:
-
handleErrorOutput
Handle error output. Send it the the new project if is present, otherwise call the super class.- Overrides:
handleErrorOutputin classTask- Parameters:
output- The string to output.- Since:
- Ant 1.5
- See Also:
-
handleErrorFlush
Handle error output. Send it the the new project if is present, otherwise call the super class.- Overrides:
handleErrorFlushin classTask- Parameters:
output- The string to output.- Since:
- Ant 1.5.2
- See Also:
-