Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在自己的Grails脚本中使用非交互模式?_Grails_Gant - Fatal编程技术网

如何在自己的Grails脚本中使用非交互模式?

如何在自己的Grails脚本中使用非交互模式?,grails,gant,Grails,Gant,我正在使用Grails2.5.0 给出一个非常简单的甘特脚本,如下面所示,我将它放在grails app/scripts/TestScript.groovy中 如何使用-non-interactive命令行标志 我尝试通过grails测试脚本和grails测试脚本运行它-非交互式,两个版本都提示我输入用户 根据设置,在这种情况下,设置-非交互式应该足以使其接受默认匿名,但事实并非如此。好吧,在看到我提出的解决方案后: includeTargets << grailsScript("_

我正在使用Grails2.5.0

给出一个非常简单的甘特脚本,如下面所示,我将它放在grails app/scripts/TestScript.groovy中

如何使用-non-interactive命令行标志

我尝试通过grails测试脚本和grails测试脚本运行它-非交互式,两个版本都提示我输入用户

根据设置,在这种情况下,设置-非交互式应该足以使其接受默认匿名,但事实并非如此。

好吧,在看到我提出的解决方案后:

includeTargets << grailsScript("_GrailsInit")


target(test: "The description of the script goes here!") {
    def name = "anonymous"
    if (isInteractive) {
        ant.input(addProperty: 'name', message: "What's your name ? ", defaultvalue: name)
        name = ant.antProject.properties.name
    }
    println "Hello ${name}"
}

setDefaultTarget(test)
如果有更好的方法,我仍然愿意接受建议

includeTargets << grailsScript("_GrailsInit")


target(test: "The description of the script goes here!") {
    def name = "anonymous"
    if (isInteractive) {
        ant.input(addProperty: 'name', message: "What's your name ? ", defaultvalue: name)
        name = ant.antProject.properties.name
    }
    println "Hello ${name}"
}

setDefaultTarget(test)