GrailsTask (Grails 2.3.8)
Date: 2014-04-24

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

## grails.ant
[Java] Class GrailsTask

    java.lang.Object
      org.apache.tools.ant.ProjectComponent
          org.apache.tools.ant.Task
              grails.ant.GrailsTask

    public class GrailsTask
    extends org.apache.tools.ant.Task

Ant task for executing Grails scripts. To use it, first create a task definition for it:

        <path id="grails.classpath">
           <fileset dir="${grails.home}/dist" includes="grails-bootstrap-*.jar"/>
           <fileset dir="${grails.home}/lib">
              <include name="groovy-all*.jar"/>
              <include name="ivy*.jar"/>
              <include name="gant_groovy*.jar"/>
           </fileset>
        </path>

        <taskdef name="grails"
                 classname="grails.ant.GrailsTask"
                 classpathref="grails.classpath"/>

You must have the "grails-bootstrap", "groovy-all", Ivy, and GPars JARs on the `taskdef`'s classpath, otherwise the task won't load.

Once the task is defined, you can use it like this:

       <grails home="${grails.home}" script="Clean"/>

The `home` attribute contains the location of a local Grails installation, while `script` is the name of the Grails script to run. Note that it's the script name not the equivalent command name.

If you want to use the Ant task without a Grails installation, then you can use the `classpathref` attribute or `classpath` nested element instead of `home`. This allows you to control precisely which JARs and versions are used to execute the Grails scripts. Typically you would use this option in conjunction with something like Ivy.

Method Summary
`void` | `addClasspath(org.apache.tools.ant.types.Path classpath)`
`void` | `addCompileClasspath(org.apache.tools.ant.types.Path compileClasspath)`
`void` | `addRuntimeClasspath(org.apache.tools.ant.types.Path runtimeClasspath)`
`void` | `addTestClasspath(org.apache.tools.ant.types.Path testClasspath)`
`void` | `execute()`
`java.lang.String` | `getArgs()`
`org.apache.tools.ant.types.Path` | `getClasspath()`
`java.lang.String` | `getCommand()`
`org.apache.tools.ant.types.Path` | `getCompileClasspath()`
`java.lang.String` | `getEnvironment()`
`java.io.File` | `getHome()`
`org.apache.tools.ant.types.Path` | `getRuntimeClasspath()`
`java.lang.String` | `getScript()`
`org.apache.tools.ant.types.Path` | `getTestClasspath()`
`boolean` | `isIncludeRuntimeClasspath()`
`protected void` | `runGrails(java.lang.String targetName, java.lang.String args)`
`void` | `setArgs(java.lang.String args)`
`void` | `setClasspathRef(org.apache.tools.ant.types.Reference ref)`
`void` | `setCommand(java.lang.String command)`
`void` | `setEnvironment(java.lang.String environment)`
`void` | `setHome(java.io.File home)`
`void` | `setIncludeRuntimeClasspath(boolean includeRuntimeClasspath)`
`void` | `setScript(java.lang.String script)`

Methods inherited from class org.apache.tools.ant.Task
org.apache.tools.ant.Task#execute(), org.apache.tools.ant.Task#getTaskName(), org.apache.tools.ant.Task#log(java.lang.String), org.apache.tools.ant.Task#log(java.lang.Throwable, int), org.apache.tools.ant.Task#log(java.lang.String, 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#getOwningTarget(), org.apache.tools.ant.Task#getTaskType(), org.apache.tools.ant.Task#setTaskType(java.lang.String), org.apache.tools.ant.Task#setTaskName(java.lang.String), 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#maybeConfigure(), 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#getDescription(), org.apache.tools.ant.Task#setLocation(org.apache.tools.ant.Location), org.apache.tools.ant.Task#getProject(), org.apache.tools.ant.Task#clone(), org.apache.tools.ant.Task#getLocation(), org.apache.tools.ant.Task#setDescription(java.lang.String), org.apache.tools.ant.Task#setProject(org.apache.tools.ant.Project), org.apache.tools.ant.Task#wait(long, int), org.apache.tools.ant.Task#wait(long), 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()

Methods inherited from class org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.ProjectComponent#getDescription(), org.apache.tools.ant.ProjectComponent#setLocation(org.apache.tools.ant.Location), org.apache.tools.ant.ProjectComponent#getProject(), org.apache.tools.ant.ProjectComponent#clone(), org.apache.tools.ant.ProjectComponent#log(java.lang.String), org.apache.tools.ant.ProjectComponent#log(java.lang.String, int), org.apache.tools.ant.ProjectComponent#getLocation(), org.apache.tools.ant.ProjectComponent#setDescription(java.lang.String), org.apache.tools.ant.ProjectComponent#setProject(org.apache.tools.ant.Project), org.apache.tools.ant.ProjectComponent#wait(long, int), org.apache.tools.ant.ProjectComponent#wait(long), org.apache.tools.ant.ProjectComponent#wait(), org.apache.tools.ant.ProjectComponent#equals(java.lang.Object), org.apache.tools.ant.ProjectComponent#toString(), org.apache.tools.ant.ProjectComponent#hashCode(), org.apache.tools.ant.ProjectComponent#getClass(), org.apache.tools.ant.ProjectComponent#notify(), org.apache.tools.ant.ProjectComponent#notifyAll()

Method Detail

### addClasspath

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

### addCompileClasspath

    @java.lang.Deprecated
    public void addCompileClasspath(org.apache.tools.ant.types.Path compileClasspath)

### addRuntimeClasspath

    @java.lang.Deprecated
    public void addRuntimeClasspath(org.apache.tools.ant.types.Path runtimeClasspath)

### addTestClasspath

    @java.lang.Deprecated
    public void addTestClasspath(org.apache.tools.ant.types.Path testClasspath)

### execute

    @java.lang.Override
    public void execute()

### getArgs

    public java.lang.String getArgs()

### getClasspath

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

### getCommand

    public java.lang.String getCommand()

### getCompileClasspath

    @java.lang.Deprecated
    public org.apache.tools.ant.types.Path getCompileClasspath()

### getEnvironment

    public java.lang.String getEnvironment()

### getHome

    public java.io.File getHome()

### getRuntimeClasspath

    @java.lang.Deprecated
    public org.apache.tools.ant.types.Path getRuntimeClasspath()

### getScript

    public java.lang.String getScript()

### getTestClasspath

    @java.lang.Deprecated
    public org.apache.tools.ant.types.Path getTestClasspath()

### isIncludeRuntimeClasspath

    public boolean isIncludeRuntimeClasspath()

### runGrails

    protected void runGrails(java.lang.String targetName, java.lang.String args)

### setArgs

    public void setArgs(java.lang.String args)

### setClasspathRef

    public void setClasspathRef(org.apache.tools.ant.types.Reference ref)

### setCommand

    public void setCommand(java.lang.String command)

### setEnvironment

    public void setEnvironment(java.lang.String environment)

### setHome

    public void setHome(java.io.File home)

### setIncludeRuntimeClasspath

    public void setIncludeRuntimeClasspath(boolean includeRuntimeClasspath)

### setScript

    public void setScript(java.lang.String script)

Groovy Documentation

``