Gradle Scanner is incompatible with upcoming configuration cache

Given a Gradle 7.4.2 project with plugin id("org.sonarqube") version "3.3" applied and the configuration block

sonarqube {
    properties {
        property("sonar.scanner.dumpToFile", layout.buildDirectory.file("").get().asFile.absolutePath)

If you now execute ./gradlew --configuration-cache sonarqube the file is properly created.
If you now delete the file and execute the same command again, the file is not recreated, because the task quits its action eagerly with the message Skipping SonarQube analysis: no properties configured, was it skipped in all projects? as it sees no configured properties.

I guess the problem is the convention mapping usage here: sonar-scanner-gradle/ at 3.3 · SonarSource/sonar-scanner-gradle · GitHub

An issues reported to Gradle for potentially detecting this incompatibility and failing is at Not-detected configuration cache problem · Issue #20562 · gradle/gradle · GitHub

As an ugly quick fix you can declare your task as being incompatible with the configuration cache, but a proper fix of the incompatibility would of course be preferable.

1 Like

Hi @Vampire

Thanks for the bug report. I was able to reproduce and I created a ticket for it: [SONARGRADL-92] sonarqube task doesn't detect cached configuration - SonarSource

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.