Groovy Documentation

org.codehaus.groovy.grails.cli.support
[Java] Class GrailsBuildHelper

java.lang.Object
  org.codehaus.groovy.grails.cli.support.GrailsBuildHelper

public class GrailsBuildHelper
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: BuildSettings and GrailsScriptRunner. This ensures class loader isolation for Grails.

Authors:
Peter Ledbrook


Constructor Summary
GrailsBuildHelper(java.lang.ClassLoader classLoader)

Creates a helper that loads the Grails build system with the given class loader.

GrailsBuildHelper(java.lang.ClassLoader classLoader, java.lang.String grailsHome)

Creates a helper that loads the Grails build system with the given class loader.

GrailsBuildHelper(java.lang.ClassLoader classLoader, java.lang.String grailsHome, java.lang.String baseDir)

 
Method Summary
int execute(java.lang.String script)

Executes the named Grails script with no arguments.

int execute(java.lang.String script, java.lang.String args)

Executes the named Grails script with the given arguments.

int execute(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.

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.io.File getResourcesDir()

java.util.List getRuntimeDependencies()

java.io.File getTestClassesDir()

java.util.List getTestDependencies()

java.io.File getTestReportsDir()

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 setProjectPluginsDir(java.io.File dir)

void setProjectWorkDir(java.io.File dir)

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
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

GrailsBuildHelper

public GrailsBuildHelper(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 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.


GrailsBuildHelper

public GrailsBuildHelper(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.


GrailsBuildHelper

public GrailsBuildHelper(java.lang.ClassLoader classLoader, java.lang.String grailsHome, java.lang.String baseDir)


 
Method Detail

execute

public int execute(java.lang.String script)
Executes the named Grails script with no arguments.
Parameters:
script - The name of the script to execute, such as "Compile".
Returns:
The value returned by the build system (notionally the exit code).


execute

public int execute(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 execute, 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).


execute

public int execute(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 execute, 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).


getClassesDir

public java.io.File getClassesDir()


getCompileDependencies

return (List) invokeMethod(settings, "getCompileDependencies", new Object[0]);
public java.util.List getCompileDependencies()


getGlobalPluginsDir

public java.io.File getGlobalPluginsDir()


getGrailsWorkDir

public java.io.File getGrailsWorkDir()


getProjectPluginsDir

public java.io.File getProjectPluginsDir()


getProjectWorkDir

public java.io.File getProjectWorkDir()


getResourcesDir

public java.io.File getResourcesDir()


getRuntimeDependencies

return (List) invokeMethod(settings, "getRuntimeDependencies", new Object[0]);
public java.util.List getRuntimeDependencies()


getTestClassesDir

public java.io.File getTestClassesDir()


getTestDependencies

return (List) invokeMethod(settings, "getTestDependencies", new Object[0]);
public java.util.List getTestDependencies()


getTestReportsDir

public java.io.File getTestReportsDir()


setBuildDependencies

invokeMethod(settings, "setBuildDependencies", new Class[] { List.class }, new Object[] { dependencies });
public void setBuildDependencies(java.util.List dependencies)


setClassesDir

public void setClassesDir(java.io.File dir)


setCompileDependencies

invokeMethod(settings, "setCompileDependencies", new Class[] { List.class }, new Object[] { dependencies });
public void setCompileDependencies(java.util.List dependencies)


setDependenciesExternallyConfigured

public void setDependenciesExternallyConfigured(boolean b)


setGlobalPluginsDir

public void setGlobalPluginsDir(java.io.File dir)


setGrailsWorkDir

public void setGrailsWorkDir(java.io.File dir)


setProjectPluginsDir

public void setProjectPluginsDir(java.io.File dir)


setProjectWorkDir

public void setProjectWorkDir(java.io.File dir)


setResourcesDir

public void setResourcesDir(java.io.File dir)


setRuntimeDependencies

invokeMethod(settings, "setRuntimeDependencies", new Class[] { List.class }, new Object[] { dependencies });
public void setRuntimeDependencies(java.util.List dependencies)


setTestClassesDir

public void setTestClassesDir(java.io.File dir)


setTestDependencies

invokeMethod(settings, "setTestDependencies", new Class[] { List.class }, new Object[] { dependencies });
public void setTestDependencies(java.util.List dependencies)


setTestReportsDir

public void setTestReportsDir(java.io.File dir)


 

Groovy Documentation