Skip to content

Commit

Permalink
Add documentation for runtime.groovy
Browse files Browse the repository at this point in the history
`runtime.groovy` was introduced in Grails 3.2 in response to grails/grails-core#10131 but was only documented in the upgrade notes, and has therefore disappeared from the latest version of the documentation.

The existence of `runtime.groovy` and the reason why it is required should be documented in the Configuration chapter.
  • Loading branch information
RobertStroud committed Mar 10, 2018
1 parent 502966d commit f35e953
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/en/guide/conf/config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@ Configuration in Grails is generally split across 2 areas: build configuration a

Build configuration is generally done via Gradle and the `build.gradle` file. Runtime configuration is by default specified in YAML in the `grails-app/conf/application.yml` file.

If you prefer to use Grails 2.0-style Groovy configuration then you can create an additional `grails-app/conf/application.groovy` file to specify configuration using Groovy's http://docs.groovy-lang.org/latest/html/documentation/#_configslurper[ConfigSlurper] syntax.
If you prefer to use Grails 2.0-style Groovy configuration then it is possible to specify configuration using Groovy's http://docs.groovy-lang.org/latest/html/documentation/#_configslurper[ConfigSlurper] syntax. Two Groovy configuration files are available: `grails-app/conf/application.config` and `grails-app/conf/runtime.config`:

. Use `application.groovy` for configuration that doesn't depend on application classes
. Use `runtime.groovy` for configuration that does depend on application classes

[NOTE]
====
This separation is necessary because configuration values defined in `application.groovy` are available to the Grails CLI, which needs to be able to load `application.groovy` before the application has been compiled. References to application classes in `application.groovy` will cause an exception when these commands are executed by the CLI:
----
Error occurred running Grails CLI:
startup failed:script14738267015581837265078.groovy: 13: unable to resolve class com.foo.Bar
----
====

For Groovy configuration the following variables are available to the configuration script:

Expand Down

0 comments on commit f35e953

Please sign in to comment.