jackson-module-kotlin
jackson-module-kotlin copied to clipboard
Module com.fasterxml.jackson.kotlin cannot be found in the module graph
Describe the bug I'm trying to use Jackson in a Kotlin/Gradle project. The library works just fine without module-info.java, but once I add one, the compilation fails. I suspect it can't find the Jackson libraries' module-info.class files from sub-folders in multi-release jars.
To Reproduce Set up Gradle:
plugins {
java
kotlin("jvm") version "1.5.30-RC"
application
}
dependencies {
implementation("com.fasterxml.jackson.module", "jackson-module-kotlin", "2.13.+")
}
...
Project's module-info.java:
module mytest.test {
requires java.base;
requires kotlin.stdlib;
requires com.fasterxml.jackson.core;
requires com.fasterxml.jackson.kotlin;
...
}
Use Jackson in the main class:
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
Build the project:
$ gradle build
...
> Task :compileKotlin FAILED
e: Module com.fasterxml.jackson.core cannot be found in the module graph
e: Module com.fasterxml.jackson.kotlin cannot be found in the module graph
Expected behavior Should compile without issues.
Versions Kotlin: 1.5.30-RC Jackson-module-kotlin: 2.13.+ Jackson-databind: 2.13.0-rc1 Gradle: 7.1.1 Java: OpenJDK 16
Additional context Also tried the older versions of toolchain without any luck.
This might be a problem with the Gradle's Kotlin plugin, but I'm wondering if there are some workaround for this.
Hmm, I know very little about Java modules still, so happy to have any suggestions.
This was caused by kotlin not being able to parse java version-specific module-info and should be fixed with kotlin 1.6.20 (currently in preview)
@miasma
Do you have any additional information on this issue?
It would be helpful if you could share the results of trying a combination of jackson 2.15.2
and Kotlin 1.5.32
or later versions, or the entire project.