Hi! I have a Ktor/Gradle application where I am tr...
# ktor
m
Hi! I have a Ktor/Gradle application where I am trying to connect to DB2 database. Its expect
db2jcc_license_cisuz.jar
, but where in IntelliJ can i add this license so i can run the application locally from Intellij?
a
You may find this answer helpful.
m
Not working 😞 When I add it this way and on kubernetes in Google Cloud it works fine
Copy code
tasks {
    named<Jar>("jar") {
        archiveBaseName.set("app")
        manifest {
            attributes["Main-Class"] = "no.nav.sokos.app.ApplicationKt"
            attributes["Class-Path"] =
                configurations.runtimeClasspath.get().joinToString(separator = " ") {
                    it.name
                }.plus("/var/run/secrets/db2license/db2jcc_license_cisuz.jar")
        }
        doLast {
            configurations.runtimeClasspath.get().forEach {
                val fileProvider: Provider<RegularFile> = layout.buildDirectory.file("libs/${it.name}")
                val targetFile = File(fileProvider.get().toString())
                if (!targetFile.exists()) {
                    it.copyTo(targetFile)
                }
            }
        }
    }
}
But when run locally on my machine it cant find the file, even if i change the path file is to on my computer path.
a
Can you check that the command, which IntelliJ IDEA executes, contains the
-cp
flag with the path of the JAR?
m
Ah, you mean this?
Change to ?
a
I mean the command in the
Run
panel.
m
CleanShot 2023-11-22 at 10.57.43.png
this one?
a
Yes
m
no -cp command here
a
If I understand the problem correctly, you need configure the IDEA to make the
-cp
flag added. For more information please read the documentation.