https://kotlinlang.org logo
Title
t

Tasos Stamadianos

03/02/2019, 7:51 PM
hi all, I have a library, let's call it
Lib
, which uses Jackson, and a client which uses
Lib
. If I try to make any calls in
Lib
which involve some Jackson calls under the hood, I get some exceptions related to Jackson not being able to load modules. The only way to fix this is to also include Jackson as a dependency in my client application, even tho it's already a dependency in
Lib
. Am I missing something here?
the specific error I get:
Exception in thread "main" java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.introspect.AnnotatedConstructor.getType()Lcom/fasterxml/jackson/databind/JavaType;
i think it may have something to do with another dependency shipping with a lower version of Jackson which breaks some compatibility, so explicitly specifying the version of jackson I want to use fixes the issue
e

efemoney

03/03/2019, 5:45 AM
It sounds like an implementation vs api configuration issue. Can you try to declare your library’s dependency on Jackson using
api("<group>:<module:<version>")
as opposed to
implementation("<group>:<module:<version>")
👍 1
n

Nikky

03/03/2019, 2:27 PM
if you think its a version mismatch that should be easy to test with a call to
./gradlew dependencies
👍 1