Skip to content



Repository files navigation


Build Status

This plugin based on the amazing work started in plugin external-config by Søren Berg Glasius, which mimiced the Grails 2 way of handling external configurations defined in grails.config.locations; with the necessary additions to allow configurations via command line, system properties, and JNDI.



Add dependency to your build.gradle:

dependencies {
    compile 'com.neilab.plugins:application-config:1.1.3'


When you add this plugin to your Grails build, it will automatically look for the property grails.config.locations. Define this in in either application.yml like this:

            - classpath:myconfig.groovy
            - classpath:myconfig.yml
            - file:///etc/app/myconfig.groovy
            - file:///etc/app/myconfig.yml
            - file:///etc/app/
            - ~/.grails/myconfig.groovy
            - ~/.grails/myconfig.yml
            - ~/.grails/
            - file:${catalina.base}/myconfig.groovy
            - file:${catalina.base}/myconfig.yml
            - file:${catalina.base}/

or in application.groovy like this:

grails.config.locations = [

You may also include external configs using '-D' arguments which match the system properties the application is seeking, preceded by an application prefix determined by in your default application.yml, application.groovy or "app" if none exists. By default the following should work:


or using JNDI variables CONFIG, EXTERNAL_CONFIG, LOGGING_CONFIG, DATABASE_CONFIG in tomcat for example:

<Context path="" docBase="/path/to/app.war"  reloadable="false">
        <Environment name="APP_CONFIG"
        <Environment name="DATABASE_CONFIG"

While no-longer necessary as of version 1.1.0 of external-config, which this fork is based, for comparability you may edit your Grails projects Application.groovy and implement the trait com.neilab.plugins.config.ApplicationConfig (formally ExternalConfig):

import com.neilab.plugins.config.ApplicationConfig

class Application extends GrailsAutoConfiguration implements ApplicationConfig {
    static void main(String[] args) {, args)

This above is necessary only when ApplicationConfigRunListener is not executed, and personally have used it only when developing the plugin as an inline plugin where SpringApplicationRunListener was not loaded.


Notice, that ~/ references the users $HOME directory. Notice, that using a system property you should use single quotes because otherwise it's interpreted as a Gstring.

The plugin will skip configuration files that are not found.

For .groovy and .yml files the environments blocks in the config file are interpreted the same way, as in application.yml or application.groovy.

Alternatively, you can make a gradle script to move the external configuration file to your classpath (e.g. /build/classes)

Using IntelliJ or gradle to specify configurations via system properties

When passing system properties via VM Options in IntelliJ or -D properties in gradle, it may be necessary to assign the parameters to the app via bootRun in your build.gradle configuration.

bootRun {
    systemProperties =


This plugin also includes two scripts, one for converting yml config, to groovy config, and one for converting groovy config to yml config. These scripts are not guaranteed to be perfect, but you should report any edge cases for the yml to groovy config here:

Sample usage:

grails yml-to-groovy-config [ymlFile] [optional outputFile]
grails groovy-to-yml-config [ymlFile] [optional outputFile]


Allows Grails 3 external configuration via grails.config.locations, JNDI, and system properties






No packages published


  • Groovy 96.5%
  • Shell 3.5%