Hello. I was unsure whether to create an issue in ...
# ktor
c
Hello. I was unsure whether to create an issue in ktor, since I am not sure if I am doing something wrong, or it is an actual bug. Basically, I am unable to import dependencies in a project. Steps to reproduce: 1 - Go to start.ktor.io 2 - Generate a new project 3 - Open from IntelliJ 4 - go to the single `build.gradle`file and try to import:
Copy code
implementation("org.kodein.di:kodein-di-generic-jvm:6.3.4")
implementation("org.kodein.di:kodein-di-framework-ktor-server-jvm:6.3.4")
🔴 It will fail with this error message:
Copy code
Execution failed for task ':compileKotlin'.
> Error while evaluating property 'filteredArgumentsMap' of task ':compileKotlin'
   > Could not resolve all files for configuration ':compileClasspath'.
      > Could not find org.kodein.di:kodein-di-generic-jvm:6.3.4.
        Searched in the following locations:
          - <https://repo.maven.apache.org/maven2/org/kodein/di/kodein-di-generic-jvm/6.3.4/kodein-di-generic-jvm-6.3.4.pom>
          - <https://maven.pkg.jetbrains.space/public/p/ktor/eap/org/kodein/di/kodein-di-generic-jvm/6.3.4/kodein-di-generic-jvm-6.3.4.pom>
        Required by:
            project :
      > Could not find org.kodein.di:kodein-di-framework-ktor-server-jvm:6.3.4.
        Searched in the following locations:
          - <https://repo.maven.apache.org/maven2/org/kodein/di/kodein-di-framework-ktor-server-jvm/6.3.4/kodein-di-framework-ktor-server-jvm-6.3.4.pom>
          - <https://maven.pkg.jetbrains.space/public/p/ktor/eap/org/kodein/di/kodein-di-framework-ktor-server-jvm/6.3.4/kodein-di-framework-ktor-server-jvm-6.3.4.pom>
        Required by:
            project :

Possible solution:
 - Declare repository providing the artifact, see the documentation at <https://docs.gradle.org/current/userguide/declaring_repositories.html>
However, it’s not the issue of the library I tried, even if you import other libraries except jetbrain libraries, it would also happen. What am I doing wrong here? Setup is pretty straightforward actually, nothing new added:
Copy code
val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project
val exposedVersion: String by project

plugins {
    application
    kotlin("jvm") version "1.6.10"
    id("org.jetbrains.kotlin.plugin.serialization") version "1.6.10"
}

group = "com.coroutinedispatcher"
version = "0.0.1"
application {
    mainClass.set("com.coroutinedispatcher.ApplicationKt")
}

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

dependencies {
    implementation("io.ktor:ktor-server-content-negotiation:$ktor_version")
    implementation("io.ktor:ktor-server-core:$ktor_version")
    implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
    implementation("io.ktor:ktor-server-auth:$ktor_version")
    implementation("io.ktor:ktor-server-netty:$ktor_version")
    implementation("ch.qos.logback:logback-classic:$logback_version")
    implementation("org.jetbrains.exposed:exposed-core:$exposedVersion")
    implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion")
    implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
    implementation("mysql:mysql-connector-java:8.0.19")
    implementation("org.kodein.di:kodein-di-generic-jvm:6.3.4")
    implementation("org.kodein.di:kodein-di-framework-ktor-server-jvm:6.3.4")
    testImplementation("io.ktor:ktor-server-tests:$ktor_version")
    testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
}
b
Try dropping -jvm suffix from the dependency and let gradle metadata figure out the right artefact flavour
Also make sure you're using JDK 8+ (preferably JDK 11+) and gradle 6+
AH, I know what's up! There's simply no such kodein version
a
You should try the latest version (7.10.0) org.kodein.dikodein di framework ktor server jvm7.10.0
c
nope, neither dropping JVM nor updating the version didn’t work 🤔
b
which version did you bump it to and what errors are you getting?
c
it seems like only this
Copy code
org.kodein.di:kodein-di-generic-jvm:7.3.1
is the one that it cannot be found
b
Latest is 7.10.0
That's only true for
kodein-di-framework-ktor-server-jvm
,
kodein-di-generic-jvm
seems to have stopped at
6.5.5
c
yes but not for
Copy code
kodein-di-generic-jvm
let me try 6.5.5
b
c
damn
b
you need
org.kodein.di:kodein-di:7.10.0
instead
(generic by default)
c
let me check
this seems to work, but I remember a completely different API 🙈
anyways, thanks
b
APIs change with time 😄 Back to brushing up on the docs for you!
c
yea yea, I meant that it has been a lot since I haven’t used kodein, of course that the API would have changed. However, googling: “kodein ktor” you will see the first result, which is the old one (also old design).
b
Don't google then. Official docs are great https://docs.kodein.org/kodein-di/7.10/framework/ktor.html
c
thanks