After migrating to Gradle 9, we're experiencing is...
# community-support
n
After migrating to Gradle 9, we're experiencing issues with the sonarqube plugin:
Copy code
Execution failed for task ':sonar'.
> Resolution of the configuration ':project-submodule:testCompileClasspath' was attempted without an exclusive lock. This is unsafe and not allowed.
Details in ๐Ÿงต
Am I correct in assuming that this is a bug in the plugin where it violates the following: https://docs.gradle.org/9.0.0/userguide/viewing_debugging_dependencies.html#sub:resolving-unsafe-configuration-resolution-errors > A task specifies a configuration from another project as an input file collection. Through the error stacktrace I found the following: https://github.com/SonarSource/sonar-scanner-gradle/blob/5835ab71326c7592f9b8d4068[โ€ฆ]0/src/main/java/org/sonarqube/gradle/SonarPropertyComputer.java
Copy code
for (Project childProject : enabledChildProjects) {
...
Here the plugin starts looping through all child projects. Eventually it tries to do the following: https://github.com/SonarSource/sonar-scanner-gradle/blob/5835ab71326c7592f9b8d4068[โ€ฆ]0/src/main/java/org/sonarqube/gradle/SonarPropertyComputer.java
Copy code
List<File> libraries = exists(main.getCompileClasspath().getFiles());
Which is where the build fails with the error above.
v
Yeah, the SQ plugin is full of a lot of bad practices unfortunately. I think you pretty well found the rootcause, yes.
But there is way more problems in that plugin actually
You can probably work-around this by calculating the properties yourself in a proper way. The
SonarPropertyComputer
that does that is used as convention value for a map property of the sonar task, so if you set explicit properties, the logic should not kick in, but you have to build the proper configuration yourself.
n
But there is way more problems in that plugin actually
not only in the plugin ๐Ÿ˜‰ I'll start by trying to find the place where I can file an issue for this and then move on to manual configuration. Thanks for the pointer!
v
You need to post to their forum
๐Ÿ™Œ 1