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("sonarqube.properties").get().asFile.absolutePath)
}
}
If you now execute ./gradlew --configuration-cache sonarqube
the sonarqube.properties
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/SonarQubePlugin.java 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.