https://kotlinlang.org logo
#ktor
Title
# ktor
i

IsaacMart

03/23/2024, 8:40 AM
Hello, I updated my ktor dependencies but I'm facing this guava and firebase-admin conflict. Below is my error log. kindly advise @Aleksei Tirman [JB] here are my dependencies.
Copy code
ktorVersion=2.3.9
kotlinVersion=1.9.23
logbackVersion=1.4.14
koinVersion=3.2.0
commonsCodecVersion = 1.15
kmongoVersion=4.7.0
composeVersion=1.2.0
kotlin.code.style=official
africaStalkingVersion=3.4.11
Dependency type This is the error during build time
Could not determine the dependencies of task ':shadowJar'.
Could not resolve all dependencies for configuration ':runtimeClasspath'.
> Could not resolve com.google.guavaguava31.1-jre. Required by: project : > com.google.firebasefirebase admin9.2.0 project : > com.google.firebasefirebase admin9.2.0 > com.google.api-clientgoogle api client2.2.0 project : > com.google.firebasefirebase admin9.2.0 > com.google.apiapi common2.12.0 project : > com.google.firebasefirebase admin9.2.0 > com.google.cloudgoogle cloud storage2.22.4 project : > com.google.firebasefirebase admin9.2.0 > com.google.cloudgoogle cloud firestore3.13.0 project : > com.google.firebasefirebase admin9.2.0 > com.google.cloudgoogle cloud firestore3.13.0 > com.google.cloudproto google cloud firestore bundle v13.13.0 > Module 'com.google.guava:guava' has been rejected: Cannot select module with conflict on capability 'com.google.guavalistenablefuture1.0' also provided by [com.google.guavalistenablefuture9999.0-empty-to-avoid-conflict-with-guava(runtime)] > Could not resolve com.google.guavaguava32.1.1-jre. Required by: project : > io.ktorktor server auth jwt jvm2.3.9 > com.auth0jwks rsa0.22.1 > Module 'com.google.guava:guava' has been rejected: Cannot select module with conflict on capability 'com.google.guavalistenablefuture1.0' also provided by [com.google.guavalistenablefuture9999.0-empty-to-avoid-conflict-with-guava(runtime)] > Could not resolve com.google.guavaguava30.1.1-android. Required by: project : > com.google.firebasefirebase admin9.2.0 > com.google.http-clientgoogle http client1.43.1 > Module 'com.google.guava:guava' has been rejected: Cannot select module with conflict on capability 'com.google.guavalistenablefuture1.0' also provided by [com.google.guavalistenablefuture9999.0-empty-to-avoid-conflict-with-guava(runtime)] > Could not resolve com.google.guavaguava31.0.1-android. Required by: project : > com.google.firebasefirebase admin9.2.0 > com.google.authgoogle auth library oauth2 http1.17.0 > Module 'com.google.guava:guava' has been rejected: Cannot select module with conflict on capability 'com.google.guavalistenablefuture1.0' also provided by [com.google.guavalistenablefuture9999.0-empty-to-avoid-conflict-with-guava(runtime)] > Could not resolve com.google.guavalistenablefuture9999.0-empty-to-avoid-conflict-with-guava. Required by: project : > com.google.firebasefirebase admin9.2.0 > com.google.cloudgoogle cloud storage2.22.4 project : > com.google.firebasefirebase admin9.2.0 > com.google.cloudgoogle cloud firestore3.13.0 project : > com.google.firebasefirebase admin9.2.0 > com.google.cloudgoogle cloud firestore3.13.0 > com.google.api.grpcproto google cloud firestore v13.13.0 project : > com.google.firebasefirebase admin9.2.0 > com.google.cloudgoogle cloud firestore3.13.0 > com.google.cloudproto google cloud firestore bundle v13.13.0 > Module 'com.google.guava:listenablefuture' has been rejected: Cannot select module with conflict on capability 'com.google.guavalistenablefuture9999.0-empty-to-avoid-conflict-with-guava' also provided by [com.google.guavaguava32.1.1-jre(jreRuntimeElements)] > Could not resolve com.google.guavaguava31.1-android. Required by: project : > com.google.firebasefirebase admin9.2.0 > com.google.api-clientgoogle api client2.2.0 > com.google.oauth-clientgoogle oauth client1.34.1 > Module 'com.google.guava:guava' has been rejected: Cannot select module with conflict on capability 'com.google.guavalistenablefuture1.0' also provided by [com.google.guavalistenablefuture9999.0-empty-to-avoid-conflict-with-guava(runtime)] > Could not resolve com.google.guavaguava29.0-android. Required by: project : > com.google.firebasefirebase admin9.2.0 > com.google.http-clientgoogle http client1.43.1 > io.opencensusopencensus contrib http util0.31.1 > Module 'com.google.guava:guava' has been rejected: Cannot select module with conflict on capability 'com.google.guavalistenablefuture1.0' also provided by [com.google.guavalistenablefuture9999.0-empty-to-avoid-conflict-with-guava(runtime)]
Copy code
val ktorVersion: String by project
val kotlinVersion: String by project
val logbackVersion: String by project
val kmongoVersion: String by project
val koinVersion: String by project
val compose_version: String by project
val commonsCodecVersion: String by project
val africaStalkingVersion: String by project

plugins {
    application
    kotlin("jvm") version "1.9.23"
    id("io.ktor.plugin") version "2.3.9"
    id("org.jetbrains.kotlin.plugin.serialization") version "1.9.23"
    id("com.github.johnrengelman.shadow") version "8.1.1"
}

group = "com.tasksfy"
version = "0.0.1"

application {
    mainClass.set("io.ktor.server.netty.EngineMain")
    project.setProperty("mainClassName", mainClass.get())

    val isDevelopment: Boolean = project.ext.has("development")
    applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}

repositories {
    mavenCentral()
    maven {
        url = uri("<https://maven.pkg.jetbrains.space/public/p/ktor/eap>")

        setUrl("<https://jitpack.io>")

    }

}

val sshAntTask = configurations.create("sshAntTask")

dependencies {

    implementation("io.ktor:ktor-server-core-jvm:$ktorVersion")
    implementation("io.ktor:ktor-server-websockets-jvm:$ktorVersion")
    implementation("io.ktor:ktor-server-content-negotiation-jvm:$ktorVersion")
    implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:$ktorVersion")
    implementation("io.ktor:ktor-server-call-logging-jvm:$ktorVersion")
    implementation("io.ktor:ktor-server-default-headers-jvm:$ktorVersion")
    implementation("io.ktor:ktor-server-caching-headers-jvm:$ktorVersion")
    implementation("io.ktor:ktor-server-host-common-jvm:$ktorVersion")
    implementation("io.ktor:ktor-server-status-pages-jvm:$ktorVersion")
    implementation("io.ktor:ktor-server-locations-jvm:$ktorVersion")
    implementation("io.ktor:ktor-server-sessions-jvm:$ktorVersion")
    implementation("io.ktor:ktor-server-auth-jvm:$ktorVersion")
    implementation("io.ktor:ktor-server-auth-jwt-jvm:$ktorVersion")
    implementation("io.ktor:ktor-server-netty-jvm:$ktorVersion")
    implementation("ch.qos.logback:logback-classic:$logbackVersion")
    testImplementation("io.ktor:ktor-server-tests-jvm:$ktorVersion")
    testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion")

    // Serving static files
//    implementation ("io.ktor:ktor-server-static:$ktorVersion")


    // Gson
    implementation("io.ktor:ktor-serialization-gson-jvm:$ktorVersion")
    testImplementation("com.google.code.gson:gson:2.10.1")

    // Firebase
    implementation("com.google.firebase:firebase-admin:9.2.0")

    // KMongo
    implementation("org.litote.kmongo:kmongo:$kmongoVersion")
    implementation("org.litote.kmongo:kmongo-coroutine:$kmongoVersion")

    implementation("commons-codec:commons-codec:$commonsCodecVersion")

    //Koin core features
    implementation("io.insert-koin:koin-ktor:$koinVersion")
    implementation("io.insert-koin:koin-logger-slf4j:$koinVersion")

    // Logging
    implementation("org.slf4j:slf4j-simple:2.0.12")

    // Engine
    implementation("io.ktor:ktor-client-core:$ktorVersion")
    implementation("io.ktor:ktor-client-cio:$ktorVersion")

    // Get all services from african stoking bulk sms
    implementation("com.github.AfricasTalkingLtd.africastalking-java:core:$africaStalkingVersion")

    sshAntTask("org.apache.ant:ant-jsch:1.10.14")




}
a

AdamW

03/23/2024, 1:28 PM
You need to sort out the transitive dependency clash: https://docs.gradle.org/current/userguide/resolution_rules.html See here also: https://docs.gradle.org/current/userguide/dependency_resolution.html Unrelated, but I don’t think you have the Jetbrains and Jitpack repositories set up correctly, you need to configure them in separate
maven
blocks 👍
👍 1
i

IsaacMart

03/23/2024, 2:20 PM
Thanks for this @AdamW. This is the only way i know. It worked out just fine. But i am ready to learn how i can set the repositories better. Do you have a resource i can follow through?
a

AdamW

03/23/2024, 3:24 PM
I think it works because you are not using any dependencies from the Jetbrains Space repo. What happens is that you overwrite the repository URL to Jitpack. See ”declaring multiple repositories” here: https://docs.gradle.org/current/userguide/declaring_repositories.html
i

IsaacMart

03/23/2024, 3:43 PM
Ooh i see. There is a lot to learn. Let me check it out. I haven't done much with ktor, only used it for my backend apps. Thanks for the resources.
👍 1
Thank you @AdamW. I resolved the issue as guided. The server is up and running again.
🤝 2
21 Views