I'm working on my multiplatform project and added ktor based backend module as part of it as i wanted to share my common code with this backend module i've added it to dependencies
implementation(project(":shared"))
But there seems to be an issue with sharing code for jvm target(which ktor backend is) I've found a workaround to have my project got this dependency resolved by marking this backend submodule as a multiplatform itself, but now as I build it and start to run I'm getting this error
Error: Could not find or load main class com.owlsoft.backend.ServerKt
My whole backend ktor build.gradle.kts
plugins {
application
kotlin("multiplatform")
id("kotlinx-serialization")
}
kotlin {
jvm {
withJava()
}
}
application {
@Suppress("DEPRECATION")
mainClassName.set("com.owlsoft.backend.ServerKt")
}
dependencies {
implementation(Libs.Coroutines.core)
implementation(Libs.KtorServer.core)
implementation(Libs.KtorServer.netty)
implementation(Libs.KtorServer.serialization)
implementation(Libs.KtorServer.websockets)
implementation(Libs.kotlinSerialization) // JVM dependency
implementation("ch.qos.logback:logback-classic:1.2.3")
implementation(project(":shared"))
testImplementation(Libs.KtorServer.test)
}
tasks.register("stage") {
dependsOn("installDist")
}
I'm mostly trying to share some models and business logic I've only made backend module with ktor in it multiplatform to fix issue with it's not being able to pick up shared module changes.