I’m having a problem with kotlin compiler complain...
# multiplatform
g
I’m having a problem with kotlin compiler complaining about a cyclic dependency which I don’t really have. My module structure looks like this: — a:domain — b:domain b:domain has a dependency on a:domain like
Copy code
api(projects.a.domain)
a:domain doesn’t have any dependencies When I try to build my project I get this exception:
Copy code
FAILURE: Build failed with an exception.

* What went wrong:
Circular dependency between the following tasks:
:b:domain:allMetadataJar
+--- :b:domain:compileCommonMainKotlinMetadata
|    +--- :b:domain:allMetadataJar (*)
|    \--- :b:domain:transformCommonMainDependenciesMetadata
|         +--- :b:domain:allMetadataJar (*)
|         +--- :b:domain:iosArm64MetadataJar
|         |    +--- :b:domain:compileAppleMainKotlinMetadata
|         |    |    +--- :b:domain:allMetadataJar (*)
|         |    |    +--- :b:domain:compileCommonMainKotlinMetadata (*)
|         |    |    +--- :b:domain:compileNativeMainKotlinMetadata
|         |    |    |    +--- :b:domain:allMetadataJar (*)
|         |    |    |    +--- :b:domain:compileCommonMainKotlinMetadata (*)
|         |    |    |    +--- :b:domain:metadataCommonMainClasses
|         |    |    |    |    \--- :b:domain:compileCommonMainKotlinMetadata (*)
|         |    |    |    \--- :b:domain:transformNativeMainDependenciesMetadata
|         |    |    |         +--- :b:domain:allMetadataJar (*)
|         |    |    |         +--- :b:domain:iosArm64MetadataJar (*)
|         |    |    |         +--- :b:domain:iosSimulatorArm64MetadataJar
|         |    |    |         |    +--- :b:domain:compileAppleMainKotlinMetadata (*)
|         |    |    |         |    +--- :b:domain:compileIosMainKotlinMetadata
|         |    |    |         |    |    +--- :b:domain:allMetadataJar (*)
|         |    |    |         |    |    +--- :b:domain:compileAppleMainKotlinMetadata (*)
|         |    |    |         |    |    +--- :b:domain:compileCommonMainKotlinMetadata (*)
|         |    |    |         |    |    +--- :b:domain:compileNativeMainKotlinMetadata (*)
|         |    |    |         |    |    +--- :b:domain:metadataAppleMainClasses
|         |    |    |         |    |    |    \--- :b:domain:compileAppleMainKotlinMetadata (*)
|         |    |    |         |    |    +--- :b:domain:metadataCommonMainClasses (*)
|         |    |    |         |    |    +--- :b:domain:metadataNativeMainClasses
|         |    |    |         |    |    |    \--- :b:domain:compileNativeMainKotlinMetadata (*)
|         |    |    |         |    |    \--- :b:domain:transformIosMainDependenciesMetadata
|         |    |    |         |    |         +--- :b:domain:allMetadataJar (*)
|         |    |    |         |    |         +--- :b:domain:iosArm64MetadataJar (*)
|         |    |    |         |    |         +--- :b:domain:iosSimulatorArm64MetadataJar (*)
|         |    |    |         |    |         +--- :b:domain:iosX64MetadataJar
|         |    |    |         |    |         |    +--- :b:domain:compileAppleMainKotlinMetadata (*)
|         |    |    |         |    |         |    +--- :b:domain:compileIosMainKotlinMetadata (*)
|         |    |    |         |    |         |    +--- :b:domain:compileNativeMainKotlinMetadata (*)
|         |    |    |         |    |         |    +--- :b:domain:metadataAppleMainClasses (*)
|         |    |    |         |    |         |    +--- :b:domain:metadataIosMainClasses
|         |    |    |         |    |         |    |    \--- :b:domain:compileIosMainKotlinMetadata (*)
|         |    |    |         |    |         |    \--- :b:domain:metadataNativeMainClasses (*)
|         |    |    |         |    |         +--- :b:domain:transformAppleMainDependenciesMetadata
|         |    |    |         |    |         |    +--- :b:domain:allMetadataJar (*)
|         |    |    |         |    |         |    +--- :b:domain:iosArm64MetadataJar (*)
|         |    |    |         |    |         |    +--- :b:domain:iosSimulatorArm64MetadataJar (*)
|         |    |    |         |    |         |    +--- :b:domain:iosX64MetadataJar (*)
|         |    |    |         |    |         |    +--- :b:domain:transformCommonMainDependenciesMetadata (*)
|         |    |    |         |    |         |    \--- :b:domain:transformNativeMainDependenciesMetadata (*)
|         |    |    |         |    |         +--- :b:domain:transformCommonMainDependenciesMetadata (*)
|         |    |    |         |    |         \--- :b:domain:transformNativeMainDependenciesMetadata (*)
|         |    |    |         |    +--- :b:domain:compileNativeMainKotlinMetadata (*)
|         |    |    |         |    +--- :b:domain:metadataAppleMainClasses (*)
|         |    |    |         |    +--- :b:domain:metadataIosMainClasses (*)
|         |    |    |         |    \--- :b:domain:metadataNativeMainClasses (*)
|         |    |    |         +--- :b:domain:iosX64MetadataJar (*)
|         |    |    |         \--- :b:domain:transformCommonMainDependenciesMetadata (*)
|         |    |    +--- :b:domain:metadataCommonMainClasses (*)
|         |    |    +--- :b:domain:metadataNativeMainClasses (*)
|         |    |    \--- :b:domain:transformAppleMainDependenciesMetadata (*)
|         |    +--- :b:domain:compileIosMainKotlinMetadata (*)
|         |    +--- :b:domain:compileNativeMainKotlinMetadata (*)
|         |    +--- :b:domain:metadataAppleMainClasses (*)
|         |    +--- :b:domain:metadataIosMainClasses (*)
|         |    \--- :b:domain:metadataNativeMainClasses (*)
|         +--- :b:domain:iosSimulatorArm64MetadataJar (*)
|         \--- :b:domain:iosX64MetadataJar (*)
\--- :b:domain:metadataCommonMainClasses (*)
changing the name to of b:domain to b:foobar fixes the issue. It seems very similar to this https://youtrack.jetbrains.com/issue/KT-30348 but that was fixed a long time ago. Anyone got any tips on how to fix this without having to come up with unique project names for all module?
👀 1
🧵 2
a
confusing subprojects with the same name is a longstanding Gradle footgun https://github.com/gradle/gradle/issues/847 Either rename the subprojects so they're different (my preference). Alternatively, you can set
group
to be different in each subproject. That way the Maven
group:artifact
coordinates will be distinct per subproject, so Gradle can differentiate them.
g
Alright, I don’t want to change the group so I guess I’ll have to go for renaming the subprojects then. Thanks
👍 1