Answer the question
In order to leave comments, you need to log in
How to combine frontend and backend in one kotlin multiplatform project?
I want to write a web application with a backend on kotlin under jvm and a frontend on kotlin-js. I configured multiplatform jvm + js in build.gradle. It compiles, but in build/classes/kotlin/js/main, but it should be in src/jvmMain/resources, so that later it can be added to jar. And I also did not understand how to add resources to the jar.
plugins {
kotlin("multiplatform") version "1.3.31"
}
repositories {
mavenCentral()
jcenter()
}
kotlin {
jvm()
js()
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
}
}
jvm().compilations["main"].defaultSourceSet {
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("io.ktor:ktor-server-netty:1.1.4")
}
}
// Не работает
//js().compilations["main"].output.classesDirs.from("src/jvmMain/resources")
}
}
Answer the question
In order to leave comments, you need to log in
The answer is here: https://kotlinlang.ru/docs/reference/multiplatform.html
It turns out in search I forgot to write "top: 0;" :D Sergey
helped me with this
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question