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
Gradle-如何使用“运行ant任务”-&引用;名义上_Ant_Gradle_Cobertura - Fatal编程技术网

Gradle-如何使用“运行ant任务”-&引用;名义上

Gradle-如何使用“运行ant任务”-&引用;名义上,ant,gradle,cobertura,Ant,Gradle,Cobertura,我想在我的gradle构建中使用cobertura,因此我以以下方式创建了任务: ant.typedef(resource: 'tasks.properties', classpath:configurations.cobertura.asPath) ant.coberturaInstrument(...) 现在我想运行cobertura仪器。问题是我不知道如何运行这个任务,因为ant.cobertura工具(…)无法工作。还有别的办法吗?例如,类似这样的东西ant.tasks['cober

我想在我的gradle构建中使用cobertura,因此我以以下方式创建了任务:

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

现在我想运行
cobertura仪器
。问题是我不知道如何运行这个任务,因为
ant.cobertura工具(…)
无法工作。还有别的办法吗?例如,类似这样的东西
ant.tasks['cobertura-instrument'](…)
问题已解决

可以使用
name
参数更改Ant任务名称。对于
cobertura instrument
,它看起来如下所示:

ant.typedef(classname:'net.sourceforge.cobertura.ant.InstrumentTask', name:'coberturaInstrument', classpath:configurations.cobertura.asPath)
因此,任务可以通过以下方式完成:

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

您还可以像下面这样使用任务
ant.“cobertura instrument”(…)

您也可以使用像这样的任务
ant.“cobertura instrument”(…)
。谢谢@Benjamin!我认为您的答案更好,因为它不需要重命名任务。顺便说一句:我看到你在尝试使用Cobertura Ant任务。你试过了吗?没有。我试试看。再次感谢!