I'm having some issues with my setup where I have projects A depends on B depends on C, but because B gets loaded after A, it throws this error:
Copy code
org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'org.jetbrains.kotlin.jvm'.
...
org.gradle.api.internal.DefaultMutationGuard$IllegalMutationException: Gradle#projectsEvaluated(Action) on build 'project_root_name' cannot be executed in the current context.
...
The dependency is added as
api(project(":B", "namedElements"))
as required by the toolchain.
How would I go about fixing it?
t
tapchicoma
06/24/2025, 7:14 AM
Could you show the full stacktrace?
m
martmists
06/24/2025, 9:39 AM
I figured it out, apparently using tasks.withType<T> { ... } doesn't configure them lazily, instead you have to use withType<T>().configure { ... }
I forced configurations to resolve in that block, causing the problem