Cobertura任务未作为gradle构建的一部分包含

时间:2016-06-30 21:24:47

标签: gradle cobertura

我正在使用gradle进行构建。当我执行“gradle clean build”时,它会执行我的所有测试用例并构建成功。当我做一个gradle清洁cobertura它产生我的cobertura报告。我想将cobertura报告作为gradle构建的一部分进行整合。我在build.gradle中尝试了以下选项,但它给了我一个错误。

build{

 dependsOn cobertura

}

我得到的错误。有什么想法吗?

Could not determine the dependencies of task ':build'.
> Cannot convert net.saliman.gradle.plugin.cobertura.CoberturaExtension_Decorated@528e5e38 to a task.
The following types/formats are supported:
- A String or CharSequence task name or path
- A Task instance
- A Buildable instance
- A TaskDependency instance
- A Closure instance that returns any of the above types
- A Callable instance that returns any of the above types
- An Iterable, Collection, Map or array instance that contains any of the above types

1 个答案:

答案 0 :(得分:1)

cobertura是扩展名。创建cobertura报告的任务称为coberturaReport

所以你必须这样做:

build.dependsOn coberturaReport