Anyone knows how to create gradle JavaExec configu...
# gradle
t
Anyone knows how to create gradle JavaExec configuration for multiplatform project?
Copy code
tasks.create<JavaExec>("run") {
    classpath = //?
    mainClass.set("com.example.MainKt")
}
sourceSets
container is at this point empty.
configurations
container does not have
jvmMainRuntime
configuration.
h
I didnt manage to get it to work either. Workarounded by adding a second gradle subproject for that, maybe thats a feasible workaround for you too up until someone tells us how its done ^^"
e
easiest way to do it, IMO:
Copy code
val jvmJar by tasks.existing
val jvmRuntimeClasspath by configurations.existing
tasks.register<JavaExec>("run") {
    description = "Runs this project as a JVM application"
    group = ApplicationPlugin.APPLICATION_GROUP
    classpath(jvmJar, jvmRuntimeClasspath)
    mainClass.set("...")
}
🙏 1
1169 Views