Skip to content

Commit 9dbd0e5

Browse files
committed
Improve Sonar and Jacoco plugin configurations
1 parent f2f54ca commit 9dbd0e5

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

build.gradle

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ subprojects { subproject ->
187187
destinationFile = file("$buildDir/jacoco.exec")
188188
}
189189
useJUnitPlatform()
190+
191+
if (System.properties['sonar.host.url']) {
192+
finalizedBy jacocoTestReport
193+
}
190194
}
191195

192196
checkstyle {
@@ -196,14 +200,13 @@ subprojects { subproject ->
196200

197201
jacocoTestReport {
198202
reports {
199-
xml.enabled false
203+
xml.enabled true
200204
csv.enabled false
201-
html.destination file("${buildDir}/reports/jacoco/html")
205+
html.enabled false
206+
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
202207
}
203208
}
204209

205-
build.dependsOn jacocoTestReport
206-
207210
publishing {
208211
publications {
209212
mavenJava(MavenPublication) {
@@ -339,6 +342,16 @@ project ('spring-kafka-test') {
339342
}
340343
}
341344

345+
sonarqube {
346+
properties {
347+
property 'sonar.links.homepage', linkHomepage
348+
property 'sonar.links.ci', linkCi
349+
property 'sonar.links.issue', linkIssue
350+
property 'sonar.links.scm', linkScmUrl
351+
property 'sonar.links.scm_dev', linkScmDevConnection
352+
}
353+
}
354+
342355
configurations {
343356
docs
344357
}
@@ -417,18 +430,6 @@ task reference(dependsOn: asciidoctor) {
417430

418431
reference.onlyIf { "$System.env.NO_REFERENCE_TASK" != 'true' || project.hasProperty('ignoreEnvToStopReference') }
419432

420-
sonarqube {
421-
properties {
422-
property 'sonar.jacoco.reportPath', "${buildDir.name}/jacoco.exec"
423-
property 'sonar.links.homepage', linkHomepage
424-
property 'sonar.links.ci', linkCi
425-
property 'sonar.links.issue', linkIssue
426-
property 'sonar.links.scm', linkScmUrl
427-
property 'sonar.links.scm_dev', linkScmDevConnection
428-
property 'sonar.java.coveragePlugin', 'jacoco'
429-
}
430-
}
431-
432433
task api(type: Javadoc) {
433434
group = 'Documentation'
434435
description = 'Generates aggregated Javadoc API documentation.'

0 commit comments

Comments
 (0)