Opentok SDK not Spring-boot compliant due new Jack

2019-09-12 01:46发布

My Spring-boot application started failing once Jackson 2.9 was released on 2nd of March. I am using Gradle for building and Spring boot version 1.5.2 which depends on Jackson-core 2.8.7.

In addition I need Opentok SDK which I have added as dependency:

compile group: 'com.tokbox', name: 'opentok-server-sdk', version: '2.3.2'

I suppose the reason is the Opentok SDK dependency definition which allows downloading newer JAR for Jackson which then creates a mismatch of libraries as several versions of Jackson JARs are downloaded:

https://github.com/opentok/Opentok-Java-SDK/blob/master/build.gradle

dependencies {
    ...
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '[2.3.1,2.99999)'

How to sort this out? I am not an expert of Gradle but could I somehow force Opentok to use 2.8.7 version? I cannot deliver at the moment at all so please help.

2条回答
贪生不怕死
2楼-- · 2019-09-12 02:05

I think this should be useful: https://docs.gradle.org/current/userguide/dependency_management.html#sub:version_conflicts

As well as the guide here: https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.dsl.DependencyHandler.html#N1627D

Approaches might differ, but you can set Gradle to force = true for Spring's jackson-databind dependency.

查看更多
倾城 Initia
3楼-- · 2019-09-12 02:16

This is how I sorted it out

compile ('com.tokbox:opentok-server-sdk:2.3.2')
{
    // Jackson 2.9 is not compatible with Spring boot 1.4.4 - 1.5.2
    exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'
}
查看更多
登录 后发表回答