Error when running sonar task with Gradle 9.0.0-rc-1

Currently we prepare the migration to Gradle 9. Our whole Android project build and pipeline is working so far. But we get the following error when running sonar Gradle task:

[2025-07-03T14:42:18.387Z] > Task :sonar FAILED
[2025-07-03T14:42:18.387Z] 
[2025-07-03T14:42:18.387Z] FAILURE: Build failed with an exception.
[2025-07-03T14:42:18.387Z] 
[2025-07-03T14:42:18.387Z] * What went wrong:
[2025-07-03T14:42:18.387Z] Execution failed for task ':sonar'.
[2025-07-03T14:42:18.387Z] > Resolution of the configuration ':app:debugCompileClasspath' was attempted without an exclusive lock. This is unsafe and not allowed.
[2025-07-03T14:42:18.387Z] 
[2025-07-03T14:42:18.387Z] * Try:
[2025-07-03T14:42:18.387Z] > For more information, please refer to https://docs.gradle.org/9.0.0-rc-1/userguide/viewing_debugging_dependencies.html.html#sub:resolving-unsafe-configuration-resolution-errors in the Gradle documentation.
[2025-07-03T14:42:18.387Z] > Run with --stacktrace option to get the stack trace.
[2025-07-03T14:42:18.387Z] > Run with --info or --debug option to get more log output.
[2025-07-03T14:42:18.387Z] > Run with --scan to generate a Build Scan (Powered by Develocity).
[2025-07-03T14:42:18.387Z] > Get more help at https://help.gradle.org.
[2025-07-03T14:42:18.387Z] 
[2025-07-03T14:42:18.387Z] BUILD FAILED in 5s

We are using sonar plugin version 6.2.0.5505.

With Gradle 8.14.2 everthing is working.

Would be nice if you could verify that and make sure we are not blocked when Gradle 9 hits final.

Hi @G00fY2,

Thank you for reporting this issue. Could you share how you invoke the :sonar task? On its own? With another task?

That would help us narrow down how the issue is triggered?

Thanks,

Dorian

Hi @Dorian_Burihabwa,

thanks for your reply. We have a dedicated step in our pipeline which simply executes:

sh “./gradlew sonar”

In general we use Sonarqube in an mixed Android and Kotlin-only multimodule project. There is no special configuration or logic involved.

The tasks succeeds with latest stable Gradle 8.14.3.

I can try to provide a reproducable project. But I thought you might have some test projects where you can check Gradle 9.0.0-rc-1 aswell and see if you run into the same issue.

Edit: Okay I saw there is work going on.
SCANGRADLE-234 Add Gradle 9.0.0-rc-1 to ITs

As a workaround adding --no-parallel seems to fix the issue (was suggested here).

Hey @G00fY2,

I can try to provide a reproducable project.

We would really appreciate if you could share such a project :folded_hands: .

Because a lot of our tests tend to run on code that was frozen a while ago (to detect regressions), we sometimes miss more modern use cases.

Cheers,

Dorian

Hi @Dorian_Burihabwa,

maybe I find time to set up sonar plugin inside an existing open source project like GitHub - android/nowinandroid: A fully functional Android app built entirely with Kotlin and Jetpack Compose.

But I also saw that you are already able to reproduce this error in your integrations tests, right?

We updated to 9.0.0-rc-3. There were some changes done to support parallel execution:

Still the sonar tasks only succeeds when adding “–no-parallel”. New error message without this is:

> Task :sonar FAILED
1 problem was found storing the configuration cache.
- Task `:sonar` of type `org.sonarqube.gradle.SonarTask`: error writing value of type 'org.gradle.api.internal.provider.DefaultMapProperty'