简体   繁体   中英

Specify Groovy AntBuilder execution directory

I can execute a pom.xml with goals using AntBuilder like so.

def ant = new AntBuilder()
ant.sequential {
    exec(executable:'mvn') {
        arg(value:'clean')
        arg(value:'install')
    }
}

But how do I specify the execution directory to the AntBuilder? I'd like to just pass an absolute path.

For the record I've tried.

ant.project.setProperty('basedir', "${serviceRootDir}/")

and

ant.sequential {
    mkdir(dir:"${serviceRootDir}/")...

You'd think this would be clear in the doc.

This works for me:

ant.exec(executable:"ls", dir:"/your/desired/directory")

It executes ls in the given directory, so mvn should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM