I'm on Windows 7. Inside my Grails (2.3.6) app's Config.groovy
file I have:
grails.config.locations = [
"file:/etc/myapp/env.groovy"
]
// fizz.buzz is defined inside env.groovy
println "fizz.buzz=${fizz.buzz}"
At the root of my D:\
drive:
etc/
myapp/
env.groovy
When I run grails -Dgrails.env=local run-app
I get the following output:
fizz.buzz=[:]
What's going on here? Why can't Grails find my env.groovy
file and/or read its properties?
My permissions:
Running File('/etc/myapp/env.groovy').absolutePath
in the Groovy Console, I get:
Exception thrown
groovy.lang.MissingMethodException: No signature of method: ConsoleScript2.File() is
applicable for argument types: (java.lang.String) values: [/etc/myapp/env.groovy]
Possible solutions: find(), find(groovy.lang.Closure), use([Ljava.lang.Object;),
with(groovy.lang.Closure), is(java.lang.Object), wait()
I also tried running my app and passing in the value for fizz.buzz
on the command line via a switch like so:
grails -Dgrails.env=local -Dfizz.buzz="true" run-app
The result was the same. Is it possible that the configs ARE being read in, but are just not available (caching, etc.) at the time that the println
is running inside Config.groovy
?