Hi, i have been trying to set up my project my pro...
# ktor
r
Hi, i have been trying to set up my project my project uses plugins: • kotlin multiplatform 1.9.21 • io.ktor.plugin version 2.3.7 but when i try to add the ktor dependency in the jvm sourceset: implementation("io.ktor:ktor-server-netty") gradle says that it can't resolve the dependency version. Does ktor gradle plugin support kotlin multiplatform? If yes, then what could go wrong. my build.gradle.kts(plugin versions are defined somewhere else):
Copy code
plugins {
    kotlin("multiplatform")
    id("io.ktor.plugin")
}

kotlin {
    jvm()

    sourceSets {
        jvmMain {
            dependencies {
                implementation("io.ktor:ktor-server-core")
                implementation("io.ktor:ktor-server-netty")
            }
        }
    }
}
a
I’m not sure I understand, the Ktor Gradle plugin will not apply versions to your dependencies at all. It’s for creating a distribution, and more often than not it’s not necessary.
p
Maybe "ktor-bom" is applied somewhere but it doesn't apply the rules to the jvmMain sourceSet somehow. You could also add
implementation("io.ktor:ktor-bom:2.3.7")
to make sure the latest version is used. The ktor gradle plugins seems to be used only for building fat jars and docker images. https://github.com/ktorio/ktor-build-plugins/
r
@AdamW
👍 2
I took a quick look at the code, that applies the bom. And it seems like it doesn't support kmp
a
today i learned - I’ve just used version catalogs for this.
r
@p-schneider thanks for help, i applied the bom as a platform, and it worked
p
Oh, sure as platform - I forgot about that part. 👍
r
I just realized that i didn't remove the version part, after removing the version part of the dependency notation. The bom doesn't seem to be working, and the ktor dependencies i removed the version notation from are unresolved by gradle.
p
The bom needs to have the version part, that's the point. But the advantage of the bom is that you only have to specify the version once (in the bom) and you can then use whatever
io.ktor:*
artifact without specifying the version again. So the only benefit is, that the versions are aligned to whatever you specify in the bom, but you still need to specify the version for the bom itself.
implementation(project.dependencies.platform("io.ktor:ktor-bom:2.3.7"))
r
the bom has the version part in my build script
👍 1