views:

103

answers:

1

Hi!

I'm using Groovy's AntBuilder to execute Ant tasks:

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

The output lines are prefixed by:

[exec]

Using Ant on the command line, this is turned off by "emacs mode"

ant -emacs ...

Is there a way to switch to emacs mode using AntBuilder?

A: 

I found no general way to add command-line arguments to the AntBuilder execution, but there's a way to activate the emacs mode, although it's not that pretty:

logger = ant.project.buildListeners.find { it instanceof org.apache.tools.ant.DefaultLogger }
logger.emacsMode = true
Christoph Metzendorf
Just tested and it works! Thanks Christoph!Groovy guys, please add a groovier way to do this! :-)
Miguel Pardal
Glad I could help!
Christoph Metzendorf