Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Shaded Jackson Annotations Dependency #3972

Closed
jsurls opened this issue Apr 9, 2021 · 4 comments
Closed

Missing Shaded Jackson Annotations Dependency #3972

jsurls opened this issue Apr 9, 2021 · 4 comments

Comments

@jsurls
Copy link

jsurls commented Apr 9, 2021

I have a basic test using the Scala testcontainers lib starting a MySQL Container.

My two dependencies transitively point me to version org.testcontainers:testcontainers:jar:1.15.2:test

The testcontainers website advertises that all Jackson libs are shaded to prevent issues:
image

However it appears the MapperConfig is calling out to an unshaded Jackson Annotations lib:

  java.lang.NoSuchMethodError: com.fasterxml.jackson.annotation.JsonFormat$Value.empty()Lcom/fasterxml/jackson/annotation/JsonFormat$Value;
  at org.testcontainers.shaded.com.fasterxml.jackson.databind.cfg.MapperConfig.<clinit>(MapperConfig.java:49)
  at org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:558)
  at org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:474)

Reverting back to version org.testcontainers:testcontainers:jar:1.14.3:test works for me.

I believe this might be the cause for the omission of Jackson Annotations from being shaded:
https://github.com/testcontainers/testcontainers-java/blame/8965712f239ae3c449cec579264af5e79265f314/core/build.gradle#L188

Looking at #2882, was Jackson Annotations intended to be omitted?

@bsideup
Copy link
Member

bsideup commented Apr 10, 2021

jackson-annotation is intentionally not shaded, as part of docker-java-api.

Make sure that there is nothing that forces it to some super old version, since Value.empty() is available since 2.7, and docker-java-api depends on 2.10.x:
https://mvnrepository.com/artifact/com.github.docker-java/docker-java-api/3.2.7

@bsideup bsideup closed this as completed Apr 10, 2021
@jsurls
Copy link
Author

jsurls commented Apr 10, 2021

Thanks @bsideup. Yes unfortunately my project has an older version of Jackson. I anticipated it was ok because of the "Shaded Dependencies" image attached above.

Can the website be updated to reflect that not all Jackson libs are shaded? This was confusing as a user since it is saying "these libraries are 'shaded' into the core testcontainers JAR" but not all are intentionally shaded.

@bsideup
Copy link
Member

bsideup commented Apr 10, 2021

@jsurls you made a good discovery that that block is slightly outdated 😅 Thanks, we will reflect the last state 👍

@bsideup
Copy link
Member

bsideup commented Apr 10, 2021

I just submitted #3974 to make it less confusing. Thanks for telling us! 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants