简体   繁体   中英

Gradle - how to run ant task with “-” in name

I want to use cobertura in my gradle build so I created task in this way:

ant.typedef(resource: 'tasks.properties', classpath:configurations.cobertura.asPath)

And now I want to run cobertura-instrument . The problem is that I don't know how to run this task because ant.cobertura-instrument(...) won't work. Is there some other way to run it? For example something like this ant.tasks['cobertura-instrument'](...)

你也可以使用像这个ant."cobertura-instrument"(...)这样的任务ant."cobertura-instrument"(...)

Problem solved

Ant task name can be changed using name argument. For cobertura-instrument it looks like this:

ant.typedef(classname:'net.sourceforge.cobertura.ant.InstrumentTask', name:'coberturaInstrument', classpath:configurations.cobertura.asPath)

so task can be usd in this way:

ant.coberturaInstrument(...)

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