org.apache.tools.ant.taskdefs.optional

Class Script

Implemented Interfaces:
Cloneable

public class Script
extends Task

Executes a script.

Field Summary

Fields inherited from class org.apache.tools.ant.Task

target, taskName, taskType, wrapper

Fields inherited from class org.apache.tools.ant.ProjectComponent

description, location, project

Method Summary

void
addText(String text)
Set the script text.
Path
createClasspath()
Classpath to be used when searching for classes and resources.
void
execute()
Run the script using the helper object.
void
setClasspath(Path classpath)
Set the classpath to be used when searching for classes and resources.
void
setClasspathRef(Reference r)
Set the classpath by reference.
void
setLanguage(String language)
Defines the language (required).
void
setManager(String manager)
Defines the manager.
void
setProject(Project project)
Set the project.
void
setSetBeans(boolean setBeans)
Set the setbeans attribute.
void
setSrc(String fileName)
Load the script from an external file ; optional.

Methods inherited from class org.apache.tools.ant.Task

bindToOwner, execute, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

Methods inherited from class org.apache.tools.ant.ProjectComponent

clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject

Method Details

addText

public void addText(String text)
Set the script text.
Parameters:
text - a component of the script text to be added.

createClasspath

public Path createClasspath()
Classpath to be used when searching for classes and resources.
Returns:
an empty Path instance to be configured by Ant.

execute

public void execute()
            throws BuildException
Run the script using the helper object.
Overrides:
execute in interface Task
Throws:
BuildException - if something goes wrong with the build

setClasspath

public void setClasspath(Path classpath)
Set the classpath to be used when searching for classes and resources.
Parameters:
classpath - an Ant Path object containing the search path.

setClasspathRef

public void setClasspathRef(Reference r)
Set the classpath by reference.
Parameters:
r - a Reference to a Path instance to be used as the classpath value.

setLanguage

public void setLanguage(String language)
Defines the language (required).
Parameters:
language - the scripting language name for the script.

setManager

public void setManager(String manager)
Defines the manager.
Parameters:
manager - the scripting manager.

setProject

public void setProject(Project project)
Set the project.
Overrides:
setProject in interface ProjectComponent
Parameters:
project - the project that this task belongs to.

setSetBeans

public void setSetBeans(boolean setBeans)
Set the setbeans attribute. If this is true, <script> will create variables in the script instance for all properties, targets and references of the current project. It this is false, only the project and self variables will be set. The default is true.
Parameters:
setBeans - the value to set.

setSrc

public void setSrc(String fileName)
Load the script from an external file ; optional.
Parameters:
fileName - the name of the file containing the script source.