I'm using Grails 2.5.0.
Given a very simple Gant script like the following, which I put in grails-app/scripts/TestScript.groovy
includeTargets << grailsScript("_GrailsInit")
target(test: "The description of the script goes here!") {
ant.input(addProperty: 'name', message: "What's your name ? ", defaultvalue: 'anonymous')
println "Hello ${ant.antProject.properties.name}"
}
setDefaultTarget(test)
How do I make it work with the --non-interactive command-line flag ?
I tried to run it through grails test-script
and grails test-script --non-interactive
and both versions prompt me for the user input.
According to the documentation, setting --non-interactive should suffice to make it accept the defaults (anonymous in this case), but it's not.
Well, after seeing this source code I came up with this solution :
I'm still open to suggestions if there is a better way...