Executes a series of Groovy statements.
Statements can either be read in from a text file using the src attribute or from between the enclosing groovy tags.
Type | Name and description |
---|---|
protected void |
addClassPathes(GroovyClassLoader classLoader) Adds the class paths (if any) |
void |
addFileset(FileSet set) Adds a set of files (nested fileset attribute). |
void |
addText(String txt) Set an inline command to execute. |
Commandline.Argument |
createArg() |
Path |
createClasspath() Returns a new path element that can be configured. |
protected void |
execGroovy(String txt, PrintStream out) Exec the statement. |
void |
execute() Load the file and then execute it |
Path |
getClasspath() Gets the classpath. |
static void |
main(String[] args) |
protected void |
printResults(PrintStream out) print any results in the statement. |
protected void |
runStatements(Reader reader, PrintStream out) Read in lines and execute them. |
void |
setAppend(boolean append) Whether output should be appended to or overwrite an existing file. |
void |
setClasspath(Path classpath) Sets the classpath for loading. |
void |
setClasspathRef(Reference ref) Set the classpath for loading using the classpath reference. |
void |
setConfigscript(String configscript) Sets the configuration script for the groovy compiler configuration. |
void |
setContextClassLoader(boolean contextClassLoader) Setting to true will cause the contextClassLoader to be set with the classLoader of the shell used to run the script. |
void |
setFork(boolean fork) Should the script be executed using a forked process. |
void |
setIncludeAntRuntime(boolean includeAntRuntime) Should the system classpath be included on the classpath when forking. |
void |
setIndy(boolean indy) Sets the indy flag to enable or disable invokedynamic |
void |
setOutput(File output) Set the output file; optional, defaults to the Ant log. |
void |
setScriptBaseClass(String scriptBaseClass) Set the script base class name |
void |
setSrc(File srcFile) Set the name of the file to be run. |
void |
setStacktrace(boolean stacktrace) Enable compiler to report stack trace information if a problem occurs during compilation. |
void |
setUseGroovyShell(boolean useGroovyShell) Should a new GroovyShell be used when forking. |
Adds the class paths (if any)
classLoader
- the classloader to configureAdds a set of files (nested fileset attribute).
set
- the fileset representing source filesSet an inline command to execute. NB: Properties are not expanded in this text.
txt
- the inline groovy commands to executeReturns a new path element that can be configured. Gets called for instance by Ant when it encounters a nested <classpath> element.
Exec the statement.
txt
- the groovy source to execout
- not used?Load the file and then execute it
Gets the classpath.
print any results in the statement.
out
- the output PrintStream to print toRead in lines and execute them.
reader
- the reader from which to get the groovy source to execout
- the outputstream to useWhether output should be appended to or overwrite an existing file. Defaults to false.
append
- set to true to appendSets the classpath for loading.
classpath
- The classpath to setSet the classpath for loading using the classpath reference.
ref
- the refid to useSets the configuration script for the groovy compiler configuration.
configscript
- path to the configuration scriptSetting to true will cause the contextClassLoader to be set with the classLoader of the shell used to run the script. Not used if fork is true. Not allowed when running from Maven but in that case the context classLoader is set appropriately for Maven.
contextClassLoader
- set to true to set the context classloaderShould the script be executed using a forked process. Defaults to false.
fork
- true if the script should be executed in a forked processShould the system classpath be included on the classpath when forking. Defaults to true.
includeAntRuntime
- true if the system classpath should be on the classpathSets the indy flag to enable or disable invokedynamic
indy
- true means invokedynamic support is activeSet the output file; optional, defaults to the Ant log.
output
- the output fileSet the script base class name
scriptBaseClass
- the name of the base class for scriptsSet the name of the file to be run. The folder of the file is automatically added to the classpath. Required unless statements are enclosed in the build file
srcFile
- the file containing the groovy script to executeEnable compiler to report stack trace information if a problem occurs during compilation.
stacktrace
- set to true to enable stacktrace reportingShould a new GroovyShell be used when forking. Special variables won't be available but you don't need Ant in the classpath.
useGroovyShell
- true if GroovyShell should be used to run the script directly