Olivier Patry
07/05/2023, 7:19 PM.jar dependencies to my multiplatform project without luck so far.
In a regular Gradle project for Jvm, everything is fine, adding the fileTree to my dependencies section works.
In a multiplatform Gradle project (using .gradle.kts) in the jvmMain section, Gradle syncs properly, the content listed by the fileTree is correct (checked thanks to printed fileTree(...).files) but nothing resolves in the IDE completion after.
If I manually tweak the module dependencies in the IntelliJ UI (thus editing the under the hood .iml project definition), I get access to the expected types in my *.jar but it fails at runtime (I guess it's normal, the launch is using Gradle I assume).
If I tweak the runtime classpath in
tasks.named<JavaExec>("run")
and launch in command line, it works.
I also tried adding the fileTree dependency to the kotlin.jvm.dependencies section without more success.
So, I'm wondering why the dependencies section of jvmMain ignores the jar files provided as implementation.Olivier Patry
07/05/2023, 7:23 PMkotlin {
jvm {
jvmToolchain(17)
withJava()
...
}
sourceSets {
...
val jvmMain by getting {
dependencies {
...
implementation(fileTree(mapOf("dir" to file("../dir_with_my_jars"), "include" to listOf("*.jar"))))
}
}
}
}Olivier Patry
07/05/2023, 7:31 PMplugins {
kotlin("multiplatform") version "1.8.21"
application
}Olivier Patry
07/05/2023, 7:45 PMplugins {
kotlin("jvm")
}
dependencies {
implementation(fileTree(mapOf("dir" to file("../dir_with_my_jars"), "include" to listOf("*.jar"))))
}Hristijan
12/21/2023, 4:07 PMOlivier Patry
12/21/2023, 4:19 PM