In Kotlin Multiplatform it seems like hierarchical...
# multiplatform
m
In Kotlin Multiplatform it seems like hierarchical structure is supposed to be a feature. However, in order to use the
commonMain
module with any dependencies I must have the
kotlin.internal.mpp.hierarchicalStructureByDefault=false
flag specified in my gradle.properties file. This issue on YouTrack claims that the problem is fixed with IntelliJ 2022.3 and Kotlin 1.7.20 (if I'm reading it correctly), but with those versions it still is not fixed. Does this happen to anyone else? Am I doing something wrong with my project? Here is a more in-depth explanation of the issue
a
I wonder if the
application
and
kotlin("multiplatform")
plugins aren’t playing nice together. Maybe IntelliJ isn’t correctly creating the module dependencies, so isn’t realising that
jvmMain
extends
commonMain
? Can you adding
Copy code
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:${Versions.serialization}")
to
jvmMain
?
m
@Adam S sorry I missed this reply. To be clear, the issue is that no dependencies are resolved in the
commonMain
project if the flag is not present; the
jvmMain
does resolve the dependencies properly. I tried removing the
application
plugin altogether and refreshed Gradle without the flag, but the same issue still occurs.
Is it not an issue for everyone when doing a multiplatform web project at the very least? It happens on every computer I've tried even using the Kotlin Example project.