apply plugin: 'groovy'
apply plugin: 'cobertura' (1)
group = 'com.example'
version = '1.0.0-SNAPSHOT'
description = """Sample project with Spock tests and Cobertura code coverage"""
sourceCompatibility = 1.7
targetCompatibility = 1.7
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'net.saliman:gradle-cobertura-plugin:2.2.4' (2)
}
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile group: 'org.codehaus.groovy', name: 'groovy-all', '2.2.1'
testCompile group: 'cglib', name: 'cglib-nodeps', version:'2.2.2'
testCompile group: 'junit', name: 'junit-dep', version:'4.11'
testCompile group: 'org.spockframework', name: 'spock-core', '0.7-groovy-2.0'
testCompile group: 'org.objenesis', name: 'objenesis', version:'1.2'
}
test {
filter {
includeTestsMatching "*Spec"
}
}
cobertura {
coverageFormats = ['html', 'xml'] (3)
coverageIgnoreTrivial = true (4)
coverageIgnores = ['org.slf4j.Logger.*'] (5)
coverageReportDir = new File("$buildDir/reports/cobertura") (6)
}
test.finalizedBy(project.tasks.cobertura) (7)