There are 3 Gradle projects in a build: K/JS, shar...
# intellij
o
There are 3 Gradle projects in a build: K/JS, shared (), K/JVM. K/JS depends on
shared
and
K/JVM
should, but can't. The JVM project is incapable of consuming
shared
directly as
implementation(project(":shared"))
due to a limitation of the project framework's Gradle plugin which cannot handle KMP source set layout (Quarkus framework). Therefore, I added the
commonMain/kotlin
directory of
shared
directly as an additional source directory to the JVM project:
Copy code
sourceSets {
    val main by getting {
        kotlin.srcDir("../shared/src/commonMain/kotlin")
    }
}
However, this action makes the JVM project "take full ownership" of the directory, assigning it to its
main
source set, and this makes the symbols unresolvable in the IDE when they are referenced in the K/JS project.
This is only an IDE issue
. All code compiles without errors. It is IntelliJ IDEA which reassigns the directory to the JVM project and then fails to resolve the symbols when they are referenced other sibling projects. Does anyone have experience with similar setups, is it fixable? I have an ugly workaround using a combination of another JVM project and a symbolic link, but I'm trying to move away from that hack.
The
commonMain/kotlin
directory as seen after the JVM project takes ownership of it.
Also tried to add the sources "indirectly" in the JVM project, to no avail:
Copy code
sourceSets {
        val commonMain by creating {
            kotlin.srcDir("../shared/src/commonMain/kotlin")
        }
        val main by getting {
            dependsOn(commonMain)
        }
    }