Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.ant
[Java] Class Groovy

    java.lang.Object
      org.apache.tools.ant.ProjectComponent
          org.apache.tools.ant.Task
              org.apache.tools.ant.taskdefs.Java
                  org.codehaus.groovy.ant.Groovy

    public class Groovy
    extends org.apache.tools.ant.taskdefs.Java

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.

Version:
  \$Id\$

Method Summary
`protected void` | `addClassPathes(GroovyClassLoader classLoader)` Adds the class paths (if any)
`void` | `addFileset(org.apache.tools.ant.types.FileSet set)` Adds a set of files (nested fileset attribute).
`void` | `addText(java.lang.String txt)` Set an inline command to execute.
`org.apache.tools.ant.types.Commandline$Argument` | `createArg()`
`org.apache.tools.ant.types.Path` | `createClasspath()` Returns a new path element that can be configured.
`protected void` | `execGroovy(java.lang.String txt, java.io.PrintStream out)` Exec the statement.
`void` | `execute()` Load the file and then execute it
`org.apache.tools.ant.types.Path` | `getClasspath()` Gets the classpath.
`static void` | `main(java.lang.String[] args)`
`protected void` | `printResults(java.io.PrintStream out)`
`protected void` | `runStatements(java.io.Reader reader, java.io.PrintStream out)`
`void` | `setAppend(boolean append)` Whether output should be appended to or overwrite an existing file.
`void` | `setClasspath(org.apache.tools.ant.types.Path classpath)` Sets the classpath for loading.
`void` | `setClasspathRef(Reference ref)` Set the classpath for loading using the classpath reference.
`void` | `setContextClassLoader(boolean contextClassLoader)`
`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` | `setOutput(java.io.File output)` Set the output file; optional, defaults to the Ant log.
`void` | `setSrc(java.io.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.

Methods inherited from class org.apache.tools.ant.taskdefs.Java
org.apache.tools.ant.taskdefs.Java#setError(java.io.File), org.apache.tools.ant.taskdefs.Java#setInput(java.io.File), org.apache.tools.ant.taskdefs.Java#execute(), org.apache.tools.ant.taskdefs.Java#setClasspath(org.apache.tools.ant.types.Path), org.apache.tools.ant.taskdefs.Java#setTimeout(java.lang.Long), org.apache.tools.ant.taskdefs.Java#handleInput([B, int, int), org.apache.tools.ant.taskdefs.Java#setOutput(java.io.File), org.apache.tools.ant.taskdefs.Java#setFork(boolean), org.apache.tools.ant.taskdefs.Java#setArgs(java.lang.String), org.apache.tools.ant.taskdefs.Java#getCommandLine(), org.apache.tools.ant.taskdefs.Java#setNewenvironment(boolean), org.apache.tools.ant.taskdefs.Java#setSpawn(boolean), org.apache.tools.ant.taskdefs.Java#addSysproperty(org.apache.tools.ant.types.Environment$Variable), org.apache.tools.ant.taskdefs.Java#createBootclasspath(), org.apache.tools.ant.taskdefs.Java#setMaxmemory(java.lang.String), org.apache.tools.ant.taskdefs.Java#addSyspropertyset(org.apache.tools.ant.types.PropertySet), org.apache.tools.ant.taskdefs.Java#setCloneVm(boolean), org.apache.tools.ant.taskdefs.Java#clearArgs(), org.apache.tools.ant.taskdefs.Java#setAppend(boolean), org.apache.tools.ant.taskdefs.Java#setJar(java.io.File), org.apache.tools.ant.taskdefs.Java#createJvmarg(), org.apache.tools.ant.taskdefs.Java#setClassname(java.lang.String), org.apache.tools.ant.taskdefs.Java#createClasspath(), org.apache.tools.ant.taskdefs.Java#setClasspathRef(org.apache.tools.ant.types.Reference), org.apache.tools.ant.taskdefs.Java#setDir(java.io.File), org.apache.tools.ant.taskdefs.Java#addEnv(org.apache.tools.ant.types.Environment$Variable), org.apache.tools.ant.taskdefs.Java#setFailonerror(boolean), org.apache.tools.ant.taskdefs.Java#setJvmargs(java.lang.String), org.apache.tools.ant.taskdefs.Java#setJvm(java.lang.String), org.apache.tools.ant.taskdefs.Java#setInputString(java.lang.String), org.apache.tools.ant.taskdefs.Java#setLogError(boolean), org.apache.tools.ant.taskdefs.Java#setOutputproperty(java.lang.String), org.apache.tools.ant.taskdefs.Java#setJVMVersion(java.lang.String), org.apache.tools.ant.taskdefs.Java#addAssertions(org.apache.tools.ant.types.Assertions), org.apache.tools.ant.taskdefs.Java#addConfiguredRedirector(org.apache.tools.ant.types.RedirectorElement), org.apache.tools.ant.taskdefs.Java#getSysProperties(), org.apache.tools.ant.taskdefs.Java#createPermissions(), org.apache.tools.ant.taskdefs.Java#createArg(), org.apache.tools.ant.taskdefs.Java#setResultProperty(java.lang.String), org.apache.tools.ant.taskdefs.Java#executeJava(), org.apache.tools.ant.taskdefs.Java#setErrorProperty(java.lang.String), org.apache.tools.ant.taskdefs.Java#log(java.lang.String), org.apache.tools.ant.taskdefs.Java#log(java.lang.String, int), org.apache.tools.ant.taskdefs.Java#log(java.lang.Throwable, int), org.apache.tools.ant.taskdefs.Java#log(java.lang.String, java.lang.Throwable, int), org.apache.tools.ant.taskdefs.Java#init(), org.apache.tools.ant.taskdefs.Java#getTaskName(), org.apache.tools.ant.taskdefs.Java#setTaskName(java.lang.String), org.apache.tools.ant.taskdefs.Java#getTaskType(), org.apache.tools.ant.taskdefs.Java#maybeConfigure(), org.apache.tools.ant.taskdefs.Java#setTaskType(java.lang.String), org.apache.tools.ant.taskdefs.Java#getOwningTarget(), org.apache.tools.ant.taskdefs.Java#setOwningTarget(org.apache.tools.ant.Target), org.apache.tools.ant.taskdefs.Java#getRuntimeConfigurableWrapper(), org.apache.tools.ant.taskdefs.Java#setRuntimeConfigurableWrapper(org.apache.tools.ant.RuntimeConfigurable), org.apache.tools.ant.taskdefs.Java#reconfigure(), org.apache.tools.ant.taskdefs.Java#perform(), org.apache.tools.ant.taskdefs.Java#bindToOwner(org.apache.tools.ant.Task), org.apache.tools.ant.taskdefs.Java#clone(), org.apache.tools.ant.taskdefs.Java#getLocation(), org.apache.tools.ant.taskdefs.Java#getDescription(), org.apache.tools.ant.taskdefs.Java#setLocation(org.apache.tools.ant.Location), org.apache.tools.ant.taskdefs.Java#setDescription(java.lang.String), org.apache.tools.ant.taskdefs.Java#getProject(), org.apache.tools.ant.taskdefs.Java#setProject(org.apache.tools.ant.Project), org.apache.tools.ant.taskdefs.Java#wait(long), org.apache.tools.ant.taskdefs.Java#wait(long, int), org.apache.tools.ant.taskdefs.Java#wait(), org.apache.tools.ant.taskdefs.Java#equals(java.lang.Object), org.apache.tools.ant.taskdefs.Java#toString(), org.apache.tools.ant.taskdefs.Java#hashCode(), org.apache.tools.ant.taskdefs.Java#getClass(), org.apache.tools.ant.taskdefs.Java#notify(), org.apache.tools.ant.taskdefs.Java#notifyAll()

Methods inherited from class org.apache.tools.ant.Task
org.apache.tools.ant.Task#log(java.lang.String), org.apache.tools.ant.Task#log(java.lang.String, int), org.apache.tools.ant.Task#log(java.lang.Throwable, int), org.apache.tools.ant.Task#log(java.lang.String, java.lang.Throwable, int), org.apache.tools.ant.Task#init(), org.apache.tools.ant.Task#execute(), org.apache.tools.ant.Task#getTaskName(), org.apache.tools.ant.Task#setTaskName(java.lang.String), org.apache.tools.ant.Task#getTaskType(), org.apache.tools.ant.Task#maybeConfigure(), org.apache.tools.ant.Task#setTaskType(java.lang.String), org.apache.tools.ant.Task#getOwningTarget(), org.apache.tools.ant.Task#setOwningTarget(org.apache.tools.ant.Target), org.apache.tools.ant.Task#getRuntimeConfigurableWrapper(), org.apache.tools.ant.Task#setRuntimeConfigurableWrapper(org.apache.tools.ant.RuntimeConfigurable), org.apache.tools.ant.Task#reconfigure(), org.apache.tools.ant.Task#perform(), org.apache.tools.ant.Task#bindToOwner(org.apache.tools.ant.Task), org.apache.tools.ant.Task#clone(), org.apache.tools.ant.Task#getLocation(), org.apache.tools.ant.Task#getDescription(), org.apache.tools.ant.Task#setLocation(org.apache.tools.ant.Location), org.apache.tools.ant.Task#setDescription(java.lang.String), org.apache.tools.ant.Task#getProject(), org.apache.tools.ant.Task#setProject(org.apache.tools.ant.Project), org.apache.tools.ant.Task#wait(long), org.apache.tools.ant.Task#wait(long, int), org.apache.tools.ant.Task#wait(), org.apache.tools.ant.Task#equals(java.lang.Object), org.apache.tools.ant.Task#toString(), org.apache.tools.ant.Task#hashCode(), org.apache.tools.ant.Task#getClass(), org.apache.tools.ant.Task#notify(), org.apache.tools.ant.Task#notifyAll()

Method Detail

### addClassPathes

    protected void addClassPathes(GroovyClassLoader classLoader)

  Adds the class paths (if any)
  Parameters:
    `classLoader` - the classloader to configure

### addFileset

    public void addFileset(org.apache.tools.ant.types.FileSet set)

  Adds a set of files (nested fileset attribute).
  Parameters:
    `set` - the fileset representing source files

### addText

    public void addText(java.lang.String txt)

  Set an inline command to execute. NB: Properties are not expanded in this text.
  Parameters:
    `txt` - the inline groovy ommands to execute

### createArg

    public org.apache.tools.ant.types.Commandline$Argument createArg()

### createClasspath

    public org.apache.tools.ant.types.Path createClasspath()

  Returns a new path element that can be configured. Gets called for instance by Ant when it encounters a nested <classpath> element.
  Returns:
    the resulting created path

### execGroovy

    protected void execGroovy(java.lang.String txt, java.io.PrintStream out)

  Exec the statement.
  Parameters:
    `txt` - the groovy source to exec
    `out` - not used?

### execute

    public void execute()

  Load the file and then execute it

### getClasspath

    public org.apache.tools.ant.types.Path getClasspath()

  Gets the classpath.
  Returns:
    Returns a Path

### main

    public static void main(java.lang.String[] args)

### printResults

    protected void printResults(java.io.PrintStream out)

### runStatements

    protected void runStatements(java.io.Reader reader, java.io.PrintStream out)

### setAppend

    public void setAppend(boolean append)

  Whether output should be appended to or overwrite an existing file. Defaults to false.
  Parameters:
    `append` - set to true to append

### setClasspath

    public void setClasspath(org.apache.tools.ant.types.Path classpath)

  Sets the classpath for loading.
  Parameters:
    `classpath` - The classpath to set

### setClasspathRef

    public void setClasspathRef(Reference ref)

  Set the classpath for loading using the classpath reference.
  Parameters:
    `ref` - the refid to use

### setContextClassLoader

    public void setContextClassLoader(boolean contextClassLoader)

### setFork

    public void setFork(boolean fork)

  Should the script be executed using a forked process. Defaults to false.
  Parameters:
    `fork` - true if the script should be executed in a forked process

### setIncludeAntRuntime

    public void setIncludeAntRuntime(boolean includeAntRuntime)

  Should the system classpath be included on the classpath when forking. Defaults to true.
  Parameters:
    `includeAntRuntime` - true if the system classpath should be on the classpath

### setOutput

    public void setOutput(java.io.File output)

  Set the output file; optional, defaults to the Ant log.
  Parameters:
    `output` - the output file

### setSrc

    public void setSrc(java.io.File srcFile)

  Set 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
  Parameters:
    `srcFile` - the file containing the groovy script to execute

### setStacktrace

    public void setStacktrace(boolean stacktrace)

  Enable compiler to report stack trace information if a problem occurs during compilation.
  Parameters:
    `stacktrace` - set to true to enable stacktrace reporting

### setUseGroovyShell

    public void setUseGroovyShell(boolean useGroovyShell)

  Should a new GroovyShell be used when forking. Special variables won't be available but you don't need Ant in the classpath.
  Parameters:
    `useGroovyShell` - true if GroovyShell should be used to run the script directly

Groovy Documentation