This message was deleted.
# community-support
s
t
This is a problem with Gradle classloaders (see https://dev.to/autonomousapps/a-crash-course-in-classpaths-build-l08), and specific needs of the Kotlin plugin. It's not clear to me why you have the error only when adding a seemingly unrelated (to Kotlin) plugin, but the error message is clear enough: if you apply the Kotlin plugin to more than one subproject, you should add it to the root project, possibly with
apply false
to not actually apply it, but still add it to the classloader that'll be used as a parent classloader for every subproject (therefore sharing the exact same Kotlin classes). More concretely: add a
build.gradle.kts
at the root (next to the
settings.gradle.kts
with the following content:
Copy code
plugins {
  plugin("kotlin-convention") apply false
}
✅ 1
v
It's not clear to me why you have the error only when adding a seemingly unrelated (to Kotlin) plugin
You didn't think it's that easy and obvious, did you? 😄 If the build scripts have the exact same classpath, the classloader is reused for both and no problem happens. As soon as you have different classpaths, like with applying one plugin to one project not the other, you get different classloaders => boom
k
If the build scripts have the exact same classpath, the classloader is reused for both and no problem happens.
@Vampire that makes sense. Thank you for the explanation! @Thomas Broyer thank you! Adding the
id("kotlin-convention") apply false
to the root Gradle module fixes the problem. I will use it as a solution to get rid of the warning