Skip to content
Advertisement

gradle runtime dependency makes test fail because of jackson dependencies issue

On a JEE project running on Wildfly 15, I am trying to configure the logs to be in json format. Replicating what I have done dozens of times for some more recent Spring Boot projects, I am adding net.logstash.logback:logstash-logback-encoder:6.6 as a runtimeOnly dependency, as I plan to have a logback.xml config file.

When building my application and running the test, adding this dependency makes some tests fail : some controllers are not able to serialize LocalDateTime anymore.

JavaScript

I don’t understand why a dependency supposed to be used for logging interferes with the way the REST response gets built… and jackson-datatype-jsr310 IS part of the classpath. When I run the dependencies task, I get this :

JavaScript

I really don’t understand how and why this conflicts…

Advertisement

Answer

I don’t think I understand the reason, but after trying different things, only downgrading the version from 6.6 to 6.4 helped. Now dependencies look like that :

JavaScript

I don’t understand why in that case jackson-datatype-jsr310:2.10.4 doesn’t get upgraded automatically by 2.11.0, while it was upgraded to 2.12.0 previously.

This is OK for now, but a bit scarry for the future : next time somebody tries to upgrade versions on this application, it’s likely that there will be some issues..

What seems to also work is if I exclude the transitive dependency – then, I can even use latest logback-encoder version :

JavaScript

So if anyone understands what is going on and how to make it more reliable for the future, don’t hesitate to make suggestions !

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement