简体   繁体   中英

Kotlin Multiplatform project import jvm variant

I have a Kotlin Multiplatform project that targets both Jvm and Android.

Creating separate javafx and android sample projects, but for my javafx module when I add the dependency for my multiplatform module, it is importing the -android variant.

// sample-javafx build.gradle.kts

plugins {
    kotlin("jvm")
    // javafx plugins
    id("application")
}

// gradle stuff...

dependencies {
    // this imports the -android variant
    implementation(project("my-multiplatform-module"))
}

For example, when importing a published multiplatform library you can specify the -jvm variant, like:

// build.gradle.kts

dependencies {
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.0")
}

How can I configure the dependency for my javafx sample to import the -jvm variant of my kmp library project module?

My wild guess is that in this case the multiplatform library is not exposing a jvm artifact explicitly, this could be a potential feature request

Alternatively you could try publishToMavenLocal() and consume it from local maven

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM