<@U03FP6RKVJS> <https://community.sonarsource.com/...
# gsoc-2025-improving-cc
n
@Rafael Chaves https://community.sonarsource.com/t/sonarscanner-for-gradle-does-not-support-the-configuration-cache/145833/4 Is this true? marking a task in gradle 9 with notCompatible will discard the cache
I remember that in gradle 9 tasks that break cc , gradle make it notCompatible internally so it doesn't break the full build
and I still don't understand what they want , this plugin is popular and marking this task will not affect anything , but their maintenirs if they remove it , issues may appear and be fixed , personally when I removed the mark the cache stored normally
r
marking a task in gradle 9 with notCompatible will discard the cache
Not only in Gradle 9. That has been true in previous releases as well. Not sure if at some point that was not the case.
I remember that in gradle 9 tasks that break cc , gradle make it notCompatible internally so it doesn't break the full build
I am not sure what you are referring to, Nouran. Gradle never marks plugin tasks as incompatible. Maybe you are referring to graceful degradation, which was indeed introduced in Gradle 9, but it covers only Gradle own tasks, not 3rd-party plugin tasks.
😯 1
Maybe the person is referring to the effect of
-Dorg.gradle.configuration-cache.problems=warn
. That has indeed changed in 9.0, and that is what Gradle 9.0 release notes refer to.
Starting with Gradle 9.0.0, the presence of incompatible tasks in the work graph results in the cache entry being discarded regardless of the warning mode to ensure correctness.
The bold part is what changed.
n
so how to confirm is it breaking or not as apparently none of the known pattern exist
r
apparently none of the known pattern exist
What do you mean, Nouran? Patterns for/of what?
n
I mean the known breaking cc patterns
r
Ah
Can you share how you are testing it? What does your build look like? What is the command that you issue to run Gradle?
Also, could you share the full output of the build?
apparently none of the known pattern exist
There are other ways code can be incompatible with CC, i.e. it is not only about accessing the task project (though that is the most common). Serialization issues is another common class of problems, and may include references to
Project
, but not necessarily.
So it may miss a visual inspection.
Also, your test may be failing to cause the incompatibility to occur.
I commented the develocity part and I am using publishToMaven to test my local changes which is commenting the notCompatible mark
I am using
./gradlew build -configuration-cache
Copy code
nouranatef@Nouran sonar-testt %  ./gradlew build -configuration-cache
Configuration cache is an incubating feature.
Calculating task graph as configuration cache cannot be reused because file 'settings.gradle' has changed.

BUILD SUCCESSFUL in 279ms
2 actionable tasks: 2 up-to-date
Configuration cache entry stored.
they have gradle test , I add
.withArguments('sonarqube','--configuration-cache', '--info', '-Dsonar.scanner.internal.dumpToFile=' + outFile.toAbsolutePath())
the cc on in this line and this is the error that I got
Copy code
Gradle runtime: support for using a Java agent with TestKit builds is not yet implemented with the configuration cache.
It is not, right? You need to invoke tasks from Sonar to exercise them, like
Copy code
./gradlew sonar --configuration-cache
n
Copy code
./gradlew sonar --configuration-cache
Starting a Gradle Daemon, 7 stopped Daemons could not be reused, use --status for details
Configuration cache is an incubating feature.
Calculating task graph as no configuration cache is available for tasks: sonar

> Task :sonar FAILED
Failed to query JRE metadata: GET https://api.sonarcloud.io/analysis/jres?os=macos&arch=arm64 failed with HTTP 401. Please check the property sonar.token or the environment variable SONAR_TOKEN.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sonar'.
> The scanner boostrapping has failed! See the logs for more details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
1 actionable task: 1 executed
Configuration cache entry discarded.
r
Is there a way to user sonar task that does not require a token?
Or maybe it is trivial to obtain one. The plugin documentation should help.
n
okay I will do my research
okay , now I have token and I add it to my test project
Copy code
nouranatef@Nouran sonar-testt % ./gradlew sonar --configuration-cache
Configuration cache is an incubating feature.
Reusing configuration cache.

BUILD SUCCESSFUL in 13s
1 actionable task: 1 executed
Configuration cache entry reused.
I add a simple test case to my fork to test it and it passed also
r
Do you have any code Sonar could process?
Is it a Java project?
Could you please update the test project (on github)?
Maybe try with one of the Gradle sample projects here: https://github.com/SonarSource/sonar-scanning-examples
šŸ‘ 1
n
I updated my test project
r
If you are still unable to reproduce it, I'd try one of the example projects from their repo
n
If you have time, I’d really appreciate it.
r
Sorry, it was a suggestion for you to do it šŸ˜†
🫣 1