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.
| Constructor and Description |
|---|
GrailsTask() |
| Modifier and Type | Method and Description |
|---|---|
void |
addClasspath(org.apache.tools.ant.types.Path classpath) |
void |
addCompileClasspath(org.apache.tools.ant.types.Path compileClasspath)
Deprecated.
|
void |
addRuntimeClasspath(org.apache.tools.ant.types.Path runtimeClasspath)
Deprecated.
|
void |
addTestClasspath(org.apache.tools.ant.types.Path testClasspath)
Deprecated.
|
void |
execute() |
java.lang.String |
getArgs() |
org.apache.tools.ant.types.Path |
getClasspath() |
java.lang.String |
getCommand() |
org.apache.tools.ant.types.Path |
getCompileClasspath()
Deprecated.
|
java.lang.String |
getEnvironment() |
java.io.File |
getHome() |
org.apache.tools.ant.types.Path |
getRuntimeClasspath()
Deprecated.
|
java.lang.String |
getScript() |
org.apache.tools.ant.types.Path |
getTestClasspath()
Deprecated.
|
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) |
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypepublic void execute()
throws org.apache.tools.ant.BuildException
execute in class org.apache.tools.ant.Taskorg.apache.tools.ant.BuildExceptionprotected void runGrails(java.lang.String targetName,
java.lang.String args)
public java.lang.String getCommand()
public void setCommand(java.lang.String command)
public java.io.File getHome()
public void setHome(java.io.File home)
public java.lang.String getScript()
public void setScript(java.lang.String script)
public java.lang.String getArgs()
public void setArgs(java.lang.String args)
public java.lang.String getEnvironment()
public void setEnvironment(java.lang.String environment)
public boolean isIncludeRuntimeClasspath()
public void setIncludeRuntimeClasspath(boolean includeRuntimeClasspath)
public org.apache.tools.ant.types.Path getClasspath()
public void addClasspath(org.apache.tools.ant.types.Path classpath)
public void setClasspathRef(org.apache.tools.ant.types.Reference ref)
@Deprecated public org.apache.tools.ant.types.Path getCompileClasspath()
@Deprecated public void addCompileClasspath(org.apache.tools.ant.types.Path compileClasspath)
@Deprecated public org.apache.tools.ant.types.Path getTestClasspath()
@Deprecated public void addTestClasspath(org.apache.tools.ant.types.Path testClasspath)
@Deprecated public org.apache.tools.ant.types.Path getRuntimeClasspath()
@Deprecated public void addRuntimeClasspath(org.apache.tools.ant.types.Path runtimeClasspath)