Skip to content

Commit 2cb8794

Browse files
raphaelDLrwinch
authored andcommitted
Restored Jacoco default task dependence
This commit ensures that the jacoco plugin is applied when calling check and test tasks. Also remoed the clean task that prevented sonarqube using coverage data Fixes: gh-6199
1 parent 1a80d4a commit 2cb8794

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

Jenkinsfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ try {
3030
checkout scm
3131
withCredentials([string(credentialsId: 'spring-sonar.login', variable: 'SONAR_LOGIN')]) {
3232
try {
33-
sh "./gradlew clean jacocoTestReport sonarqube -Dsonar.jacoco.reportPaths='**/build/jacoco/*.exec' -PexcludeProjects='**/samples/**' -Dsonar.host.url=$SPRING_SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN --refresh-dependencies --no-daemon --stacktrace"
33+
sh "./gradlew sonarqube -PexcludeProjects='**/samples/**' -Dsonar.host.url=$SPRING_SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN --refresh-dependencies --no-daemon --stacktrace"
3434
} catch(Exception e) {
3535
currentBuild.result = 'FAILED: sonar'
3636
throw e

build.gradle

-15
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,8 @@ ext.milestoneBuild = !(snapshotBuild || releaseBuild)
1919

2020
dependencyManagementExport.projects = subprojects.findAll { !it.name.contains('-boot') }
2121

22-
// Disable JaCoCo when not explicitly requested to enable caching of test
23-
// See https://discuss.gradle.org/t/do-not-cache-if-condition-matched-jacoco-agent-configured-with-append-true-satisfied/23504
24-
gradle.taskGraph.whenReady { graph ->
25-
def enabled = graph.allTasks.any { it instanceof JacocoReport }
26-
subprojects { project ->
27-
project.plugins.withType(JacocoPlugin) {
28-
project.tasks.withType(Test) {
29-
jacoco.enabled = enabled
30-
}
31-
}
32-
}
33-
}
34-
35-
3622
subprojects {
3723
plugins.withType(JavaPlugin) {
3824
project.sourceCompatibility='1.8'
3925
}
4026
}
41-

0 commit comments

Comments
 (0)