Dear Gradle Community
(Repost into the correct user group gradle-user, instead of nabble)
I'm new to Gradle and I'm using Gradle 0.9.2.
I found
http://www.gradle.org/0.9.2/docs/userguide/init_scripts.html and I wanted to do some per environment scripting with init.gradle
I wanted to do a some basic Groovy scripting (figuring out which spring-context.xml to add to the build path) and pass this information into the build. I'm aware that there are gradle.properties to achive similar things, but I wanted to do some additional Groovy scripting, so using init.gradle seems to be the way.
This was surprisingly hard.
The user guide, Google, did not help very much. Essentially the main information I got was the one line from:
http://www.gradle.org/0.9.2/docs/dsl/index.html"Init script (delegates to instance of) Gradle"
so after some try and error I came up with this init.gradle:
'''
println 'foos init.gradle is being executed'
gradle.beforeProject {
it.environmentSpecificClassPathFormInitScript = 'src/main/environments/foo'
}
'''
so my question: Is this the correct use of init.gradle if I want to pass a value into the build.gradle?
If yes: please consider documenting it a bit better at
I found
http://www.gradle.org/0.9.2/docs/userguide/init_scripts.htmlas this page documents special cases like dependencies but not the very basic
Please consider including the the words "switching environments" somewhere in the user guide or tutorials or FAQ as it was really hard to find via Google.