example project (written in Gradle 8.1.1 with kotlin DSL):
https://github.com/tribbloid/scaffold-gradle-kts/tree/16bf3acffca7b83a7e64dbb248a9512caba87e71
This project has 3+ submodules:
include(":lightweight-dependency:core")
include(":lightweight-dependency:extra") // depends on :lightweight-dependency:core
include(":core") // depends on lightweight-dependency:extra
...
When being compiled, it gave the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Circular dependency between the following tasks:
:core:compileJava
+--- :core:compileJava (*)
+--- :core:compileKotlin
| +--- :core:compileJava (*)
| +--- :core:compileKotlin (*)
| \--- :core:compileScala
| +--- :core:compileJava (*)
| +--- :core:compileKotlin (*)
| \--- :core:compileScala (*)
\--- :core:compileScala (*)
(*) - details omitted (listed previously)
This is problematic as :lightweight-dependency:core
and :core
should be different projects. How to ensure that Gradle can differentiate them?