groovy ConfigSlurper using string, number, boolean or list


Example

In the file myConfig.groovy is the following content.

message = 'Hello World!'
aNumber=42
aBoolean=false
aList=["apples", "grapes", "oranges"]

Then in your main script you create a ConfigSlurper for your myConfig.groovy file which is really just another groovy script.

config = new ConfigSlurper().parse(new File('/path/to/myConfig.groovy').toURL())

Then to use the items from the config you can just refer to them.

assert 'Hello World!' == config.message
assert 42 == config.aNumber
assert false == config.aBoolean
assert ["apples", "grapes", "oranges"] == config.aList