Gradle 格拉德尔项目+;cobertura-为什么可以';我是否为多个子项目生成报告?
在根级项目中,我有一个Gradle 格拉德尔项目+;cobertura-为什么可以';我是否为多个子项目生成报告?,gradle,report,cobertura,Gradle,Report,Cobertura,在根级项目中,我有一个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'] coverageRepor
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")
}
}
但是当我运行/gradlew cobertura
时,它只会在根项目上生成reports/cobertura目录
这是怎么回事?试试看
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")
}
}
}