Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs.optional

public Class Script

extends Task
Class Inheritance
Imports
java.io.File, org.apache.tools.ant.BuildException, .Project, .Task, org.apache.tools.ant.types.Path, .Reference, org.apache.tools.ant.util.ScriptManager, .ScriptRunnerHelper

Executes a script.

Field Summary

Modifier and TypeField and Description
private ScriptRunnerHelper
Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addText(String
a component of the script text to be added.
text
)

Set the script text.

public Path

Returns:

an empty Path instance to be configured by Ant.
createClasspath
()

Classpath to be used when searching for classes and resources.

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Run the script using the helper object.
public void
setClasspath(Path
an Ant Path object containing the search path.
classpath
)

Set the classpath to be used when searching for classes and resources.

public void
setClasspathRef(Reference
a Reference to a Path instance to be used as the classpath value.
r
)

Set the classpath by reference.

public void
setEncoding(String
the encoding of the file containing the script source.
encoding
)

Set the encoding of the script from an external file; optional.

public void
setLanguage(String
the scripting language name for the script.
language
)

Defines the language (required).

public void
setManager(String
the scripting manager.
manager
)

Deprecated
Defines the manager.
public void
setManager(ScriptManager manager)

Set the script manager.

public void
setProject(Project
the project that this task belongs to.
project
)

Overrides org.apache.tools.ant.ProjectComponent.setProject.

Set the project.
public void
setSetBeans(boolean
the value to set.
setBeans
)

Set the setbeans attribute.

public void
setSrc(String
the name of the file containing the script source.
fileName
)

Load the script from an external file; optional.

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

helperback to summary
private ScriptRunnerHelper helper

Constructor Detail

Scriptback to summary
public Script()

Method Detail

addTextback to summary
public void addText(String text)

Set the script text.

Parameters
text:String

a component of the script text to be added.

createClasspathback to summary
public Path createClasspath()

Classpath to be used when searching for classes and resources.

Returns:Path

an empty Path instance to be configured by Ant.

executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Run the script using the helper object.

Exceptions
BuildException:
if something goes wrong with the build
setClasspathback to summary
public void setClasspath(Path classpath)

Set the classpath to be used when searching for classes and resources.

Parameters
classpath:Path

an Ant Path object containing the search path.

setClasspathRefback to summary
public void setClasspathRef(Reference r)

Set the classpath by reference.

Parameters
r:Reference

a Reference to a Path instance to be used as the classpath value.

setEncodingback to summary
public void setEncoding(String encoding)

Set the encoding of the script from an external file; optional.

Parameters
encoding:String

the encoding of the file containing the script source.

Since
Ant 1.10.2
setLanguageback to summary
public void setLanguage(String language)

Defines the language (required).

Parameters
language:String

the scripting language name for the script.

setManagerback to summary
public void setManager(String manager)

Deprecated

Defines the manager.

Parameters
manager:String

the scripting manager.

Annotations
@Deprecated
setManagerback to summary
public void setManager(ScriptManager manager)

Set the script manager.

setProjectback to summary
public void setProject(Project project)

Overrides org.apache.tools.ant.ProjectComponent.setProject.

Set the project.

Parameters
project:Project

the project that this task belongs to.

setSetBeansback to summary
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:boolean

the value to set.

setSrcback to summary
public void setSrc(String fileName)

Load the script from an external file; optional.

Parameters
fileName:String

the name of the file containing the script source.