Anyone know how to import the `-jvm` variant of a ...
# multiplatform
m
Anyone know how to import the
-jvm
variant of a kmp project module?
Copy code
// javafx sample module build.gradle.kts
plugins {
    kotlin("jvm")
    application
    id("org.openjfx.javafxplugin") version("0.0.11")
}

// java/javafx/application configuration...

dependencies {
    implementation(project(":multiplatform-module"))
}
The above keeps importing the
-android
variant of my
:multiplatform-module
😢
plus1 1
j
it is impossible to import the android one in jvm, it should fail in Gradle, and that can be caused by having enabled
Copy code
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
I have seen weird behaviors with those properties if the kmp project is only jvm + android
anyway, if you just run via Gradle, for example
./gradlew assemble
it should be working with the current setup
m
Yup, I do have those flags set but because there are native targets with a hierarchical source set for the multiplatform project. Importing the multiplatform project dependency from MavenCentral, it correctly uses the
-jvm
variant, but using it via the
implementation(project(""))
dependency declaration, Android Studio is using the
-android
variant still. I've converted the
javafx
sample module to multiplatform with a single
jvm
source set and running
./gradlew :samples:javafx:run
works, so. Would still be nice to figure out what is going wrong here though.
j
Is it open source?
m
Yes, but I haven't pushed up the javafx sample yet. https://github.com/05nelsonm/kmp-tor
Just merged JavaFX sample to master. Can follow instructions on README to run it.