grails.ant
Class GrailsTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by grails.ant.GrailsTask
All Implemented Interfaces:
Cloneable

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-1.1.jar"/>
        <fileset dir="${grails.home}/lib" includes="groovy-all-1.6.jar"/>
    </path>

    <taskdef name="grails"
             classname="grails.ant.GrailsTask"
             classpathref="grails.classpath"/>
 
You must have both the "grails-bootstrap" and "groovy-all" 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.


Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
GrailsTask()
           
 
Method Summary
 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()
           
 String getArgs()
           
 org.apache.tools.ant.types.Path getClasspath()
           
 String getCommand()
           
 org.apache.tools.ant.types.Path getCompileClasspath()
          Deprecated. 
 String getEnvironment()
           
 File getHome()
           
 org.apache.tools.ant.types.Path getRuntimeClasspath()
          Deprecated. 
 String getScript()
           
 org.apache.tools.ant.types.Path getTestClasspath()
          Deprecated. 
 boolean isIncludeRuntimeClasspath()
           
protected  void runGrails(String targetName, String args)
           
 void setArgs(String args)
           
 void setClasspathRef(org.apache.tools.ant.types.Reference ref)
           
 void setCommand(String command)
           
 void setEnvironment(String environment)
           
 void setHome(File home)
           
 void setIncludeRuntimeClasspath(boolean includeRuntimeClasspath)
           
 void setScript(String script)
           
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrailsTask

public GrailsTask()
Method Detail

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException

runGrails

protected void runGrails(String targetName,
                         String args)

getCommand

public String getCommand()

setCommand

public void setCommand(String command)

getHome

public File getHome()

setHome

public void setHome(File home)

getScript

public String getScript()

setScript

public void setScript(String script)

getArgs

public String getArgs()

setArgs

public void setArgs(String args)

getEnvironment

public String getEnvironment()

setEnvironment

public void setEnvironment(String environment)

isIncludeRuntimeClasspath

public boolean isIncludeRuntimeClasspath()

setIncludeRuntimeClasspath

public void setIncludeRuntimeClasspath(boolean includeRuntimeClasspath)

getClasspath

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

addClasspath

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

setClasspathRef

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

getCompileClasspath

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


addCompileClasspath

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


getTestClasspath

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


addTestClasspath

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


getRuntimeClasspath

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


addRuntimeClasspath

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



Copyright (c) 2005-2009 The Grails project