org.grails.launcher
Class GrailsLauncher

java.lang.Object
  extended by org.grails.launcher.GrailsLauncher

public class GrailsLauncher
extends java.lang.Object

Helper class that allows a client to bootstrap the Grails build system in its own class loader. It basically uses reflection to handle the entry points to the build system: grails.util.BuildSettings and org.codehaus.groovy.grails.cli.GrailsScriptRunner. This ensures class loader isolation for Grails.


Constructor Summary
GrailsLauncher(java.lang.ClassLoader classLoader)
          Creates a helper that loads the Grails build system with the given class loader.
GrailsLauncher(java.lang.ClassLoader classLoader, java.lang.String grailsHome)
          Creates a helper that loads the Grails build system with the given class loader.
GrailsLauncher(java.lang.ClassLoader classLoader, java.lang.String grailsHome, java.lang.String baseDir)
          Creates a helper that loads the Grails build system with the given class loader.
 
Method Summary
 java.util.List getBuildDependencies()
           
 java.io.File getClassesDir()
           
 java.util.List getCompileDependencies()
           
 java.io.File getGlobalPluginsDir()
           
 java.io.File getGrailsWorkDir()
           
 java.io.File getProjectPluginsDir()
           
 java.io.File getProjectWorkDir()
           
 java.util.List getProvidedDependencies()
           
 java.io.File getResourcesDir()
           
 java.util.List getRuntimeDependencies()
           
 java.io.File getTestClassesDir()
           
 java.util.List getTestDependencies()
           
 java.io.File getTestReportsDir()
           
 int launch(java.lang.String script)
          Executes the named Grails script with no arguments.
 int launch(java.lang.String script, java.lang.String args)
          Executes the named Grails script with the given arguments.
 int launch(java.lang.String script, java.lang.String args, java.lang.String env)
          Executes the named Grails script with the given arguments in the specified environment.
 void setBuildDependencies(java.util.List dependencies)
           
 void setClassesDir(java.io.File dir)
           
 void setCompileDependencies(java.util.List dependencies)
           
 void setDependenciesExternallyConfigured(boolean b)
           
 void setGlobalPluginsDir(java.io.File dir)
           
 void setGrailsWorkDir(java.io.File dir)
           
 void setPlainOutput(boolean isPlain)
           
 void setProjectPluginsDir(java.io.File dir)
           
 void setProjectWorkDir(java.io.File dir)
           
 void setProvidedDependencies(java.util.List dependencies)
           
 void setResourcesDir(java.io.File dir)
           
 void setRuntimeDependencies(java.util.List dependencies)
           
 void setTestClassesDir(java.io.File dir)
           
 void setTestDependencies(java.util.List dependencies)
           
 void setTestReportsDir(java.io.File dir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrailsLauncher

public GrailsLauncher(java.lang.ClassLoader classLoader)
Creates a helper that loads the Grails build system with the given class loader. Ideally, the class loader should be an instance of RootLoader. You can try other class loaders, but you may run into problems.

Parameters:
classLoader - The class loader that will be used to load Grails.

GrailsLauncher

public GrailsLauncher(java.lang.ClassLoader classLoader,
                      java.lang.String grailsHome)
Creates a helper that loads the Grails build system with the given class loader. Ideally, the class loader should be an instance of GrailsRootLoader. You can try other class loaders, but you may run into problems.

Parameters:
classLoader - The class loader that will be used to load Grails.
grailsHome - Location of a local Grails installation.

GrailsLauncher

public GrailsLauncher(java.lang.ClassLoader classLoader,
                      java.lang.String grailsHome,
                      java.lang.String baseDir)
Creates a helper that loads the Grails build system with the given class loader. Ideally, the class loader should be an instance of GrailsRootLoader. You can try other class loaders, but you may run into problems.

Parameters:
classLoader - The class loader that will be used to load Grails.
grailsHome - Location of a local Grails installation.
baseDir - The path to the Grails project to launch the command on
Method Detail

setPlainOutput

public void setPlainOutput(boolean isPlain)

launch

public int launch(java.lang.String script)
Executes the named Grails script with no arguments.

Parameters:
script - The name of the script to launch, such as "Compile".
Returns:
The value returned by the build system (notionally the exit code).

launch

public int launch(java.lang.String script,
                  java.lang.String args)
Executes the named Grails script with the given arguments.

Parameters:
script - The name of the script to launch, such as "Compile".
args - A single string containing the arguments for the script, each argument separated by whitespace.
Returns:
The value returned by the build system (notionally the exit code).

launch

public int launch(java.lang.String script,
                  java.lang.String args,
                  java.lang.String env)
Executes the named Grails script with the given arguments in the specified environment. Normally the script is run in the default environment for that script.

Parameters:
script - The name of the script to launch, such as "Compile".
args - A single string containing the arguments for the script, each argument separated by whitespace.
env - The name of the environment to run in, e.g. "development" or "production".
Returns:
The value returned by the build system (notionally the exit code).

getGrailsWorkDir

public java.io.File getGrailsWorkDir()

setGrailsWorkDir

public void setGrailsWorkDir(java.io.File dir)

getProjectWorkDir

public java.io.File getProjectWorkDir()

setProjectWorkDir

public void setProjectWorkDir(java.io.File dir)

getClassesDir

public java.io.File getClassesDir()

setClassesDir

public void setClassesDir(java.io.File dir)

getTestClassesDir

public java.io.File getTestClassesDir()

setTestClassesDir

public void setTestClassesDir(java.io.File dir)

getResourcesDir

public java.io.File getResourcesDir()

setResourcesDir

public void setResourcesDir(java.io.File dir)

getProjectPluginsDir

public java.io.File getProjectPluginsDir()

setProjectPluginsDir

public void setProjectPluginsDir(java.io.File dir)

getGlobalPluginsDir

public java.io.File getGlobalPluginsDir()

setGlobalPluginsDir

public void setGlobalPluginsDir(java.io.File dir)

getTestReportsDir

public java.io.File getTestReportsDir()

setTestReportsDir

public void setTestReportsDir(java.io.File dir)

getCompileDependencies

public java.util.List getCompileDependencies()

setCompileDependencies

public void setCompileDependencies(java.util.List dependencies)

setDependenciesExternallyConfigured

public void setDependenciesExternallyConfigured(boolean b)

getTestDependencies

public java.util.List getTestDependencies()

setTestDependencies

public void setTestDependencies(java.util.List dependencies)

getProvidedDependencies

public java.util.List getProvidedDependencies()

setProvidedDependencies

public void setProvidedDependencies(java.util.List dependencies)

setBuildDependencies

public void setBuildDependencies(java.util.List dependencies)

getBuildDependencies

public java.util.List getBuildDependencies()

getRuntimeDependencies

public java.util.List getRuntimeDependencies()

setRuntimeDependencies

public void setRuntimeDependencies(java.util.List dependencies)