Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.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
Shell 如何在使用groovy';蚂蚁制造者_Shell_Ant_Groovy_Exec - Fatal编程技术网

Shell 如何在使用groovy';蚂蚁制造者

Shell 如何在使用groovy';蚂蚁制造者,shell,ant,groovy,exec,Shell,Ant,Groovy,Exec,我正在使用Groovy的AntBuilder执行Ant任务: def ant = new AntBuilder() ant.sequential { ant.exec(executable: "cmd", dir: "..", resultproperty: "exec-ret-code") { arg(value: "/c") arg(line: "dir") } } 输出行的前缀为: [行政长官] 在命令行上使用Ant,这将由“emacs模式

我正在使用Groovy的AntBuilder执行Ant任务:

def ant = new AntBuilder()
ant.sequential {
    ant.exec(executable: "cmd", dir: "..", resultproperty: "exec-ret-code") {
        arg(value: "/c")
        arg(line: "dir")
    }
}
输出行的前缀为:

[行政长官]

在命令行上使用Ant,这将由“emacs模式”关闭


有没有一种方法可以使用AntBuilder切换到emacs模式?

我没有找到将命令行参数添加到AntBuilder执行中的常规方法,但是有一种方法可以激活emacs模式,尽管它没有那么漂亮:

logger = ant.project.buildListeners.find { it instanceof org.apache.tools.ant.DefaultLogger }
logger.emacsMode = true

我意识到这是从2010年开始的,但对于未来的搜索者来说,这似乎是可行的:

ant.project.buildListeners[0].messageOutputLevel=0

0非常接近静默(它仍然列出了需要构建的类,但去掉了大多数其他垃圾),3非常冗长。

刚刚测试过,它可以工作!谢谢克里斯托夫!好棒的家伙们,请添加一种更棒的方法来实现这一点!:-)
ant.project.buildListeners[0].messageOutputLevel=0