I have a Kotlin Multiplatform project that uses Ko...
# gradle
t
I have a Kotlin Multiplatform project that uses Kotlin/JS and Kotlin/JVM. Here's a short version of my
build.gradle.kts
Copy code
plugins {
  kotlin("multiplatform")
  application
}

application {
  mainClass.set("path.to.my.MainKt")
}

kotlin {
  js()
  jvm()
}
I'd like to use
gradlew run
to run the
path.to.my.MainKt
file, but the
run
task doesn't want to use the runtime classpath in
jvmMain
. How do I fix this problem?
e
you can't use Gradle's
application
with Kotllin multiplatform without
withJava()
if you use
kotlin { jvm { withJava() } }
then the
application
plugin should work, but you can't add Android platform (because it conflicts with Java)
if that is an issue for you, you will have to create your own replacement for the
application
plugin, as I did in https://youtrack.jetbrains.com/issue/KT-50227
t
@ephemient Thank you!