Multi-module native build failed after upgrade to Gradle 9.0.0

I have multi-module Gradle project. It consists of 3 native Spring Boot microservices and common module. Build on 8.14.3 as well on previous versions works successfully. But after upgrade to 9.0.0 the build fails with:

The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build. 
This might happen in subprojects that apply the Kotlin plugins with the Gradle 'plugins { ... }' DSL if they specify explicit versions, even if the versions are equal.
Please add the Kotlin plugin to the common parent project or the root project, then remove the versions in the subprojects.
If the parent project does not need the plugin, add 'apply false' to the plugin line.
See: https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl
The Kotlin plugin was loaded in the following projects: ':book-service', ':common-model'
> Task :user-service:collectReachabilityMetadata FAILED

> Task :book-service:openApiGenerate                                                                                                                                                                                                                                                                           
invokerPackage with kotlin-spring generator is ignored. Use packageName.
############################################################################################                                                                                                                                                                                                                   
# Thanks for using OpenAPI Generator.                                                      #
# We appreciate your support! Please consider donation to help us maintain this project.   #
# https://opencollective.com/openapi_generator/donate                                      #
############################################################################################
Successfully generated code to ...event-driven-architecture\book-service/build/generated/openapi

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':user-service:collectReachabilityMetadata'.
> Failed to query the value of task ':user-service:collectReachabilityMetadata' property 'metadataService'.
   > Could not isolate value org.graalvm.buildtools.gradle.internal.GraalVMReachabilityMetadataService$Params_Decorated@4c8d90b of type GraalVMReachabilityMetadataService.Params
      > Resolution of the configuration ':book-service:detachedConfiguration9' was attempted without an exclusive lock. This is unsafe and not allowed.

* Try:
> For more information, please refer to https://docs.gradle.org/9.0.0/userguide/viewing_debugging_dependencies.html#sub:resolving-unsafe-configuration-resolution-errors in the Gradle documentation.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to generate a Build Scan (Powered by Develocity).
> Get more help at https://help.gradle.org.

BUILD FAILED in 3s
5 actionable tasks: 5 executed

The command to start build is ./gradlew :book-service:bootBuildImage :user-service:bootBuildImage :notification-service:bootBuildImage.

org.gradle.parallel is true in gradle.properties. If I set false, there is no error. That also increases build time.

Have tried several solutions with no result. Do I need to fix build scripts somehow or is it a bug?

Build on 8.14.3 as well on previous versions works successfully. But after upgrade to 9.0.0 the build fails with

Of course, that’s because you ignore the deprecation warnings you are getting which then usually also provide links to further information. :wink:

For a smooth upgrade experience you should always:

  • Update to latest patch version within same major version
  • Update all plugins to latest possible version
  • Fix all deprecation warnings
  • Update to latest patch version in the directly following major version
  • Go to second step and repeat until reaching the target version

It seem the GraalVM plugin is doing something bad there, no idea whether you can work-around it in your build script, I’d suggest you report the problem to them and also ask them for a work-around.

If you mean The Kotlin Gradle plugin was loaded multiple times in different subprojects as the deprecation warning, then, unfortunately, it has nothing to do with the build error: I locally fixed the warning but that doesn’t prevent the build error.

Anyway, thank you for the advice, I’ll probably report bug on the GraalVM plugin.

No, that’s not a deprecation warning, that’s a “you used me wrongly” message by the Kotlin Gradle Plugin. I’m talking about the Gradle deprecation warning.

Your posted output doesn’t include it, as it was run with Gradle 9 where it became an error. But you build output with Gradle 8 does.