2010-05-27 47 views
0

我使用Groovy的AntBuilder執行Ant任務時:如何刪除裝飾像[執行]使用Groovy的AntBuilder

def ant = new AntBuilder() 
ant.sequential { 
    ant.exec(executable: "cmd", dir: "..", resultproperty: "exec-ret-code") { 
     arg(value: "/c") 
     arg(line: "dir") 
    } 
} 

輸出線由前綴:

[執行]

在命令行上使用Ant,這是由「emacs模式」關閉

ant -emacs ... 

有沒有一種辦法使用AntBuilder切換到emacs模式?

回答

0

我發現命令行參數添加到AntBuilder執行沒有通用的方法,但有激活emacs模式的方式,儘管它不是那麼漂亮:

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

經過測試,它的工作原理!謝謝Christoph! Groovy傢伙,請添加一個groovier的方式來做到這一點! :-) – 2010-05-28 13:06:21

+0

很高興能幫到你! – 2010-05-28 13:52:55

1

我意識到這是從2010年,但對於未來搜索這似乎工作:

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

0是非常接近無聲的(它仍然列出需要建築類,但擺脫了大多數其他垃圾),3相當冗長。