napperley
04/01/2021, 3:47 AMTask with name 'compileKotlinJs' not found in root project
. If the webClient module is renamed to js then the error disappears, however a warning message appears:
Duplicate content roots detected
Christian Hausknecht
04/01/2021, 2:22 PMnapperley
04/02/2021, 2:49 AMgroup = "org.example"
version = "0.1-SNAPSHOT"
plugins {
kotlin("multiplatform") version "1.4.31"
id("dev.fritz2.fritz2-gradle") version "0.9"
application
}
application {
mainClass.set("io.ktor.server.netty.EngineMain")
}
repositories {
mavenCentral()
}
kotlin {
jvm("server") {
dependencies {
val ktorVer = "1.5.2"
implementation("io.ktor:ktor-server-core:$ktorVer")
implementation("io.ktor:ktor-server-netty:$ktorVer")
}
withJava()
}
js(name = "webClient", compiler = IR) {
browser()
}.binaries.executable()
sourceSets {
commonMain {
dependencies {
implementation("dev.fritz2:core:0.9")
}
}
}
}
Jan Weidenhaupt
04/07/2021, 7:20 AMtasks.getByName("compileKotlinJs").dependsOn("kaptKotlinJvm")
When you change the name of the js
or jvm
multiplatform-target e.g. to webClient
then this is not matching anymore...
Therefore we need a more generic way to create this task-dependency with gradle.
The second warning message comes from the line withJava()
. When you remove that call the warning should disappear. This takes me some time to figure it out, but I don't know why this warning occours when using withJava()
... ☹️Jan Weidenhaupt
04/07/2021, 9:49 AMnapperley
04/07/2021, 11:55 PMwithJava
function is required in order to use the application
Gradle plugin, which is used to run the Ktor based server. There doesn't appear to be a straightforward way to run the server, and have the Kotlin JS continuous feature running at the same time.Jan Weidenhaupt
04/09/2021, 11:25 AMwithJava
function there. The project works as expected without it and the warning of course disappers. Also, I don't use Java code in my project and therefore don't need the function withJava
. As I understand it, it is there only for using Kotlin and Java together as described here.