gradle project + cobertura - 为什么我不能为多个子项目生成报告?

时间:2017-01-24 17:59:03

标签: gradle report cobertura

在根级别项目中,我有一个 var courses = db.Employees .Include(p => p.PurchaseOrderHeaders) .Where(p => p.Gender=="Male") .Dump(); ,其中包含以下内容:

build.gradle

但是当我运行plugins { id "org.sonarqube" version "2.2.1" id 'net.saliman.cobertura' version '2.4.0' } apply plugin: 'groovy' apply plugin: 'cobertura' cobertura { coverageFormats = ['html', 'xml'] coverageReportDir = new File("$projectDir/reports/cobertura") rootProject.subprojects.each { coverageReportDir = new File("$it.name/reports/cobertura") } } 时,它只会在根项目上生成reports / cobertura目录。

这里发生了什么?

1 个答案:

答案 0 :(得分:0)

尝试

configure(allprojects) {

plugins {
    id "org.sonarqube" version "2.2.1"
    id 'net.saliman.cobertura' version '2.4.0'
}

apply plugin: 'groovy'
apply plugin: 'cobertura'

cobertura {
    coverageFormats = ['html', 'xml']
    coverageReportDir = new File("$projectDir/reports/cobertura")
    rootProject.subprojects.each {
        coverageReportDir = new File("$it.name/reports/cobertura")
    }
}
}