Groovy Documentation

grails.util
[Groovy] Class BuildSettings

java.lang.Object
  grails.util.AbstractBuildSettings
      grails.util.BuildSettings

class BuildSettings
extends AbstractBuildSettings

Represents the project paths and other build settings that the user can change when running the Grails commands. Defaults are provided for all settings, but the user can override those by setting the appropriate system property or specifying a value for it in the BuildConfig.groovy file.

Warning The behaviour is poorly defined if you explicitly set some of the project paths (such as BuildSettings.projectWorkDir), but not others. If you set one of them explicitly, set all of them to ensure consistent behaviour.


Field Summary
static java.lang.String APP_BASE_DIR

The base directory of the application

static java.lang.String BUILD_LISTENERS

The name of the system property for multiple buildListeners.

static java.lang.String CONVERT_CLOSURES_KEY

A property name to enable/disable AST conversion of closures actions&tags to methods

static java.lang.String CORE_WORKING_DIR_NAME

The name of the working directory for commands that don't belong to a project (like create-app)

static java.lang.String FUNCTIONAL_BASE_URL_PROPERTY

A system property with this name is populated in the preparation phase of functional testing with the base URL that tests should be run against.

static java.lang.String GLOBAL_PLUGINS_DIR

The name of the system property for globalPluginsDir.

static java.lang.String PLUGINS_DIR

The name of the system property for projectPluginsDir.

static java.lang.String PROJECT_CLASSES_DIR

The name of the system property for classesDir.

static java.lang.String PROJECT_DOCS_OUTPUT_DIR

The name of the system property for testReportsDir.

static java.lang.String PROJECT_PLUGIN_CLASSES_DIR

The name of the system property for pluginClassesDir.

static java.lang.String PROJECT_RESOURCES_DIR

The name of the system property for .

static java.lang.String PROJECT_SOURCE_DIR

The name of the system property for sourceDir.

static java.lang.String PROJECT_TARGET_DIR

The name of the system property for projectTargetDir.

static java.lang.String PROJECT_TEST_CLASSES_DIR

The name of the system property for testClassesDir.

static java.lang.String PROJECT_TEST_REPORTS_DIR

The name of the system property for testReportsDir.

static java.lang.String PROJECT_TEST_SOURCE_DIR

The name of the system property for testSourceDir.

static java.lang.String PROJECT_WAR_EXPLODED_DIR

The name of the system property for projectWarExplodedDir.

static java.lang.String PROJECT_WAR_FILE

The name of the WAR file of the project

static java.lang.String PROJECT_WAR_OSGI_HEADERS

The name of the system property for enabling osgi headers in the WAR Manifest

static java.lang.String PROJECT_WEB_XML_FILE

The name of the system property for BuildSettings.webXmlLocation.

static java.lang.String PROJECT_WORK_DIR

The name of the system property for projectWorkDir.

static java.lang.String VERBOSE_COMPILE

The name of the system property for enabling verbose compilation verboseCompile.

static java.lang.String WORK_DIR

The name of the system property for grailsWorkDir.

protected boolean settingsFileLoaded

 
Fields inherited from class AbstractBuildSettings
cache, config, flatConfig, globalPluginsDir, globalPluginsDirSet, projectPluginsDir, projectPluginsDirSet
 
Property Summary
static java.util.regex.Pattern JAR_PATTERN

java.util.List applicationJars

List of jars provided in the applications 'lib' directory

java.io.File baseDir

The base directory for the build, which is normally the root directory of the current project.

java.util.List buildListeners

java.io.File classesDir

The location to which Grails compiles a project's classes.

boolean convertClosuresArtefacts

GrailsCoreDependencies coreDependencies

java.util.List defaultCompileDependencies

List containing the default (resolved via the dependencyManager) compile-time dependencies of the app as File instances.

java.util.List defaultDuildDependencies

List containing the dependencies required for the build system only

boolean defaultEnv

true if the default environment for a script should be used.

java.util.Map defaultPluginMap

A Set of plugin names and versions that represent the default set of plugins installed when creating Grails applications

java.util.Set defaultPluginSet

A Set of plugin names that represent the default set of plugins installed when creating Grails applications

java.util.List defaultProvidedDependencies

List containing the dependencies needed at development time, but provided by the container at runtime *

java.util.List defaultRuntimeDependencies

List containing the default runtime-time dependencies of the app as File instances.

java.util.List defaultTestDependencies

List containing the default test-time dependencies of the app as File instances.

boolean dependenciesExternallyConfigured

Whether the project required build dependencies are externally configured (by Maven for example) or not

IvyDependencyManager dependencyManager

Manages dependencies and dependency resolution in a Grails application

java.io.File docsOutputDir

The location of the documentation output.

java.lang.String grailsEnv

The environment for the current script.

java.io.File grailsHome

Location of the Grails distribution as usually identified by the GRAILS_HOME environment variable.

groovy.lang.Closure grailsScriptClosure

Implementation of the "grailsScript()" method used in Grails scripts.

java.lang.String grailsVersion

The version of Grails being used for the current script.

java.io.File grailsWorkDir

The location of the Grails working directory where non-project-specific temporary files are stored.

boolean modified

Return whether the BuildConfig has been modified

java.io.File pluginClassesDir

The location to which Grails compiles a project's plugin classes.

java.io.File projectTargetDir

The location of the project target directory where reports, artifacts and so on are output.

java.io.File projectWarExplodedDir

The location of the Grails WAR directory where exploded WAR is built.

java.io.File projectWarFile

The WAR file of the project

boolean projectWarOsgiHeaders

Setting for whether or not to enable OSGI headers in the WAR Manifest, can be overridden via -verboseCompile(=[true|false])?

java.io.File projectWorkDir

The location of the project working directory for project-specific temporary files.

groovy.util.ConfigObject proxySettings

The settings used to establish the HTTP proxy to use for dependency resolution etc.

java.io.File proxySettingsFile

The file containing the proxy settings

java.io.File resourcesDir

The location where Grails keeps temporary copies of a project's resources.

java.net.URLClassLoader rootLoader

The root loader for the build.

java.io.File sourceDir

The location of the plain source.

java.io.File testClassesDir

The location to which Grails compiles a project's test classes.

java.io.File testReportsDir

The location of the test reports.

java.io.File testSourceDir

The location of the test source.

java.io.File userHome

Location of the current user's home directory - equivalent to "user.home" system property.

boolean verboseCompile

Setting for whether or not to enable verbose compilation, can be overridden via -verboseCompile(=[true|false])?

java.io.File webXmlLocation

Location of the generated web.xml file

 
Constructor Summary
BuildSettings()

BuildSettings(java.io.File grailsHome)

BuildSettings(java.io.File grailsHome, java.io.File baseDir)

 
Method Summary
java.lang.Object configureDependencyManager(groovy.util.ConfigObject config)

groovy.util.ConfigSlurper createConfigSlurper()

java.io.File getBaseDir()

Returns the current base directory of this project.

java.util.List getBuildDependencies()

List containing the runtime dependencies of the app as File instances.

Object[] getBuildListeners()

java.io.File getClassesDir()

java.util.List getCompileDependencies()

List containing the compile-time dependencies of the app as File instances.

boolean getConvertClosuresArtefacts()

java.lang.String getFunctionalTestBaseUrl()

java.io.File getGrailsWorkDir()

java.io.File getPluginClassesDir()

java.io.File getProjectTargetDir()

java.io.File getProjectWarExplodedDir()

java.io.File getProjectWarFile()

boolean getProjectWarOsgiHeaders()

java.io.File getProjectWorkDir()

java.util.List getProvidedDependencies()

List containing the runtime dependencies of the app as File instances.

java.io.File getResourcesDir()

java.util.List getRuntimeDependencies()

List containing the runtime dependencies of the app as File instances.

java.io.File getSourceDir()

java.io.File getTestClassesDir()

java.util.List getTestDependencies()

List containing the test-time dependencies of the app as File instances.

java.io.File getTestReportsDir()

java.io.File getTestSourceDir()

java.io.File getWebXmlLocation()

protected java.lang.Object loadBuildPropertiesFromClasspath(java.util.Properties buildProps)

groovy.util.ConfigObject loadConfig()

Loads the application's BuildSettings.groovy file if it exists and returns the corresponding config object.

groovy.util.ConfigObject loadConfig(java.io.File configFile)

Loads the given configuration file if it exists and returns the corresponding config object.

groovy.util.ConfigObject loadConfig(groovy.util.ConfigObject config)

protected groovy.util.ConfigObject loadSettingsFile()

groovy.lang.GroovyClassLoader obtainGroovyClassLoader()

protected void parseGrailsBuildListeners()

groovy.lang.Closure pluginDependencyHandler()

groovy.lang.Closure pluginDependencyHandler(IvyDependencyManager dependencyManager)

protected void postLoadConfig()

void setBaseDir(java.io.File newBaseDir)

Changes the base directory, making sure that everything that depends on it gets refreshed too.

void setBuildDependencies(java.util.List deps)

Sets the runtime dependencies for the project

void setBuildListeners(java.lang.Object buildListeners)

void setClassesDir(java.io.File dir)

void setCompileDependencies(java.util.List deps)

Sets the compile time dependencies for the project

void setConvertClosuresArtefacts(boolean convert)

void setGrailsWorkDir(java.io.File dir)

void setPluginClassesDir(java.io.File dir)

void setProjectTargetDir(java.io.File dir)

void setProjectWarExplodedDir(java.io.File dir)

void setProjectWarFile(java.io.File file)

void setProjectWarOsgiHeaders(boolean flag)

void setProjectWorkDir(java.io.File dir)

void setProvidedDependencies(java.util.List deps)

Sets the runtime dependencies for the project

void setResourcesDir(java.io.File dir)

void setRuntimeDependencies(java.util.List deps)

Sets the runtime dependencies for the project

void setSourceDir(java.io.File dir)

void setTestClassesDir(java.io.File dir)

void setTestDependencies(java.util.List deps)

Sets the test time dependencies for the project

void setTestReportsDir(java.io.File dir)

void setTestSourceDir(java.io.File dir)

void setVerboseCompile(boolean flag)

void setWebXmlLocation(java.io.File location)

 
Methods inherited from class AbstractBuildSettings
addPluginDirectory, getConfig, getGlobalPluginsDir, getImplicitPluginDirectories, getInlinePluginDirectories, getInlinePluginsFromConfiguration, getInlinePluginsFromConfiguration, getPluginBaseDirectories, getPluginDirectories, getProjectPluginsDir, isInlinePluginLocation, setConfig, setGlobalPluginsDir, setProjectPluginsDir
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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()
 

Field Detail

APP_BASE_DIR

public static final java.lang.String APP_BASE_DIR
The base directory of the application


BUILD_LISTENERS

public static final java.lang.String BUILD_LISTENERS
The name of the system property for multiple buildListeners.


CONVERT_CLOSURES_KEY

public static final java.lang.String CONVERT_CLOSURES_KEY
A property name to enable/disable AST conversion of closures actions&tags to methods


CORE_WORKING_DIR_NAME

public static final java.lang.String CORE_WORKING_DIR_NAME
The name of the working directory for commands that don't belong to a project (like create-app)


FUNCTIONAL_BASE_URL_PROPERTY

public static final java.lang.String FUNCTIONAL_BASE_URL_PROPERTY
A system property with this name is populated in the preparation phase of functional testing with the base URL that tests should be run against.


GLOBAL_PLUGINS_DIR

public static final java.lang.String GLOBAL_PLUGINS_DIR
The name of the system property for globalPluginsDir.


PLUGINS_DIR

public static final java.lang.String PLUGINS_DIR
The name of the system property for projectPluginsDir.


PROJECT_CLASSES_DIR

public static final java.lang.String PROJECT_CLASSES_DIR
The name of the system property for classesDir.


PROJECT_DOCS_OUTPUT_DIR

public static final java.lang.String PROJECT_DOCS_OUTPUT_DIR
The name of the system property for testReportsDir.


PROJECT_PLUGIN_CLASSES_DIR

public static final java.lang.String PROJECT_PLUGIN_CLASSES_DIR
The name of the system property for pluginClassesDir.


PROJECT_RESOURCES_DIR

public static final java.lang.String PROJECT_RESOURCES_DIR
The name of the system property for .


PROJECT_SOURCE_DIR

public static final java.lang.String PROJECT_SOURCE_DIR
The name of the system property for sourceDir.


PROJECT_TARGET_DIR

public static final java.lang.String PROJECT_TARGET_DIR
The name of the system property for projectTargetDir.


PROJECT_TEST_CLASSES_DIR

public static final java.lang.String PROJECT_TEST_CLASSES_DIR
The name of the system property for testClassesDir.


PROJECT_TEST_REPORTS_DIR

public static final java.lang.String PROJECT_TEST_REPORTS_DIR
The name of the system property for testReportsDir.


PROJECT_TEST_SOURCE_DIR

public static final java.lang.String PROJECT_TEST_SOURCE_DIR
The name of the system property for testSourceDir.


PROJECT_WAR_EXPLODED_DIR

public static final java.lang.String PROJECT_WAR_EXPLODED_DIR
The name of the system property for projectWarExplodedDir.


PROJECT_WAR_FILE

public static final java.lang.String PROJECT_WAR_FILE
The name of the WAR file of the project


PROJECT_WAR_OSGI_HEADERS

public static final java.lang.String PROJECT_WAR_OSGI_HEADERS
The name of the system property for enabling osgi headers in the WAR Manifest


PROJECT_WEB_XML_FILE

public static final java.lang.String PROJECT_WEB_XML_FILE
The name of the system property for BuildSettings.webXmlLocation.


PROJECT_WORK_DIR

public static final java.lang.String PROJECT_WORK_DIR
The name of the system property for projectWorkDir.


VERBOSE_COMPILE

public static final java.lang.String VERBOSE_COMPILE
The name of the system property for enabling verbose compilation verboseCompile.


WORK_DIR

public static final java.lang.String WORK_DIR
The name of the system property for grailsWorkDir.


settingsFileLoaded

protected boolean settingsFileLoaded


 
Property Detail

JAR_PATTERN

static final java.util.regex.Pattern JAR_PATTERN


applicationJars

java.util.List applicationJars
List of jars provided in the applications 'lib' directory


baseDir

java.io.File baseDir
The base directory for the build, which is normally the root directory of the current project. If a command is run outside of a project, then this will be the current working directory that the command was launched from.


buildListeners

java.util.List buildListeners


classesDir

java.io.File classesDir
The location to which Grails compiles a project's classes.


convertClosuresArtefacts

boolean convertClosuresArtefacts


coreDependencies

final GrailsCoreDependencies coreDependencies


defaultCompileDependencies

@Lazy
java.util.List defaultCompileDependencies
List containing the default (resolved via the dependencyManager) compile-time dependencies of the app as File instances.


defaultDuildDependencies

@Lazy
java.util.List defaultDuildDependencies
List containing the dependencies required for the build system only


defaultEnv

boolean defaultEnv
true if the default environment for a script should be used.


defaultPluginMap

java.util.Map defaultPluginMap
A Set of plugin names and versions that represent the default set of plugins installed when creating Grails applications


defaultPluginSet

java.util.Set defaultPluginSet
A Set of plugin names that represent the default set of plugins installed when creating Grails applications


defaultProvidedDependencies

@Lazy
java.util.List defaultProvidedDependencies
List containing the dependencies needed at development time, but provided by the container at runtime *


defaultRuntimeDependencies

@Lazy
java.util.List defaultRuntimeDependencies
List containing the default runtime-time dependencies of the app as File instances.


defaultTestDependencies

@Lazy
java.util.List defaultTestDependencies
List containing the default test-time dependencies of the app as File instances.


dependenciesExternallyConfigured

boolean dependenciesExternallyConfigured
Whether the project required build dependencies are externally configured (by Maven for example) or not


dependencyManager

IvyDependencyManager dependencyManager
Manages dependencies and dependency resolution in a Grails application


docsOutputDir

java.io.File docsOutputDir
The location of the documentation output.


grailsEnv

java.lang.String grailsEnv
The environment for the current script.


grailsHome

java.io.File grailsHome
Location of the Grails distribution as usually identified by the GRAILS_HOME environment variable. This value may be null if GRAILS_HOME is not set, for example if a project uses the Grails JAR files directly.


grailsScriptClosure

groovy.lang.Closure grailsScriptClosure
Implementation of the "grailsScript()" method used in Grails scripts.


grailsVersion

java.lang.String grailsVersion
The version of Grails being used for the current script.


grailsWorkDir

java.io.File grailsWorkDir
The location of the Grails working directory where non-project-specific temporary files are stored.


modified

boolean modified
Return whether the BuildConfig has been modified


pluginClassesDir

java.io.File pluginClassesDir
The location to which Grails compiles a project's plugin classes.


projectTargetDir

java.io.File projectTargetDir
The location of the project target directory where reports, artifacts and so on are output.


projectWarExplodedDir

java.io.File projectWarExplodedDir
The location of the Grails WAR directory where exploded WAR is built.


projectWarFile

java.io.File projectWarFile
The WAR file of the project


projectWarOsgiHeaders

boolean projectWarOsgiHeaders
Setting for whether or not to enable OSGI headers in the WAR Manifest, can be overridden via -verboseCompile(=[true|false])?


projectWorkDir

java.io.File projectWorkDir
The location of the project working directory for project-specific temporary files.


proxySettings

groovy.util.ConfigObject proxySettings
The settings used to establish the HTTP proxy to use for dependency resolution etc.


proxySettingsFile

java.io.File proxySettingsFile
The file containing the proxy settings


resourcesDir

java.io.File resourcesDir
The location where Grails keeps temporary copies of a project's resources.


rootLoader

java.net.URLClassLoader rootLoader
The root loader for the build. This has the required libraries on the classpath.


sourceDir

java.io.File sourceDir
The location of the plain source.


testClassesDir

java.io.File testClassesDir
The location to which Grails compiles a project's test classes.


testReportsDir

java.io.File testReportsDir
The location of the test reports.


testSourceDir

java.io.File testSourceDir
The location of the test source.


userHome

java.io.File userHome
Location of the current user's home directory - equivalent to "user.home" system property.


verboseCompile

boolean verboseCompile
Setting for whether or not to enable verbose compilation, can be overridden via -verboseCompile(=[true|false])?


webXmlLocation

java.io.File webXmlLocation
Location of the generated web.xml file


 
Constructor Detail

BuildSettings

BuildSettings()


BuildSettings

BuildSettings(java.io.File grailsHome)


BuildSettings

BuildSettings(java.io.File grailsHome, java.io.File baseDir)


 
Method Detail

configureDependencyManager

java.lang.Object configureDependencyManager(groovy.util.ConfigObject config)


createConfigSlurper

groovy.util.ConfigSlurper createConfigSlurper()


getBaseDir

java.io.File getBaseDir()
Returns the current base directory of this project.


getBuildDependencies

java.util.List getBuildDependencies()
List containing the runtime dependencies of the app as File instances.


getBuildListeners

Object[] getBuildListeners()


getClassesDir

java.io.File getClassesDir()


getCompileDependencies

java.util.List getCompileDependencies()
List containing the compile-time dependencies of the app as File instances.


getConvertClosuresArtefacts

boolean getConvertClosuresArtefacts()


getFunctionalTestBaseUrl

java.lang.String getFunctionalTestBaseUrl()


getGrailsWorkDir

java.io.File getGrailsWorkDir()


getPluginClassesDir

java.io.File getPluginClassesDir()


getProjectTargetDir

java.io.File getProjectTargetDir()


getProjectWarExplodedDir

java.io.File getProjectWarExplodedDir()


getProjectWarFile

java.io.File getProjectWarFile()


getProjectWarOsgiHeaders

boolean getProjectWarOsgiHeaders()


getProjectWorkDir

java.io.File getProjectWorkDir()


getProvidedDependencies

java.util.List getProvidedDependencies()
List containing the runtime dependencies of the app as File instances.


getResourcesDir

java.io.File getResourcesDir()


getRuntimeDependencies

java.util.List getRuntimeDependencies()
List containing the runtime dependencies of the app as File instances.


getSourceDir

java.io.File getSourceDir()


getTestClassesDir

java.io.File getTestClassesDir()


getTestDependencies

java.util.List getTestDependencies()
List containing the test-time dependencies of the app as File instances.


getTestReportsDir

java.io.File getTestReportsDir()


getTestSourceDir

java.io.File getTestSourceDir()


getWebXmlLocation

java.io.File getWebXmlLocation()


loadBuildPropertiesFromClasspath

protected java.lang.Object loadBuildPropertiesFromClasspath(java.util.Properties buildProps)


loadConfig

groovy.util.ConfigObject loadConfig()
Loads the application's BuildSettings.groovy file if it exists and returns the corresponding config object. If the file does not exist, this returns an empty config.


loadConfig

groovy.util.ConfigObject loadConfig(java.io.File configFile)
Loads the given configuration file if it exists and returns the corresponding config object. If the file does not exist, this returns an empty config.


loadConfig

groovy.util.ConfigObject loadConfig(groovy.util.ConfigObject config)


loadSettingsFile

protected groovy.util.ConfigObject loadSettingsFile()


obtainGroovyClassLoader

groovy.lang.GroovyClassLoader obtainGroovyClassLoader()


parseGrailsBuildListeners

protected void parseGrailsBuildListeners()


pluginDependencyHandler

groovy.lang.Closure pluginDependencyHandler()


pluginDependencyHandler

groovy.lang.Closure pluginDependencyHandler(IvyDependencyManager dependencyManager)


postLoadConfig

protected void postLoadConfig()


setBaseDir

void setBaseDir(java.io.File newBaseDir)

Changes the base directory, making sure that everything that depends on it gets refreshed too. If you have have previously loaded a configuration file, you should load it again after calling this method.

Warning This method resets the project paths, so if they have been set manually by the caller, then that information will be lost!


setBuildDependencies

void setBuildDependencies(java.util.List deps)
Sets the runtime dependencies for the project


setBuildListeners

void setBuildListeners(java.lang.Object buildListeners)


setClassesDir

void setClassesDir(java.io.File dir)


setCompileDependencies

void setCompileDependencies(java.util.List deps)
Sets the compile time dependencies for the project


setConvertClosuresArtefacts

void setConvertClosuresArtefacts(boolean convert)


setGrailsWorkDir

void setGrailsWorkDir(java.io.File dir)


setPluginClassesDir

void setPluginClassesDir(java.io.File dir)


setProjectTargetDir

void setProjectTargetDir(java.io.File dir)


setProjectWarExplodedDir

void setProjectWarExplodedDir(java.io.File dir)


setProjectWarFile

void setProjectWarFile(java.io.File file)


setProjectWarOsgiHeaders

void setProjectWarOsgiHeaders(boolean flag)


setProjectWorkDir

void setProjectWorkDir(java.io.File dir)


setProvidedDependencies

void setProvidedDependencies(java.util.List deps)
Sets the runtime dependencies for the project


setResourcesDir

void setResourcesDir(java.io.File dir)


setRuntimeDependencies

void setRuntimeDependencies(java.util.List deps)
Sets the runtime dependencies for the project


setSourceDir

void setSourceDir(java.io.File dir)


setTestClassesDir

void setTestClassesDir(java.io.File dir)


setTestDependencies

void setTestDependencies(java.util.List deps)
Sets the test time dependencies for the project


setTestReportsDir

void setTestReportsDir(java.io.File dir)


setTestSourceDir

void setTestSourceDir(java.io.File dir)


setVerboseCompile

void setVerboseCompile(boolean flag)


setWebXmlLocation

void setWebXmlLocation(java.io.File location)


 

Groovy Documentation