问题
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.
回答1:
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.
回答2:
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'
}
来源:https://stackoverflow.com/questions/42631135/opentok-sdk-not-spring-boot-compliant-due-new-jackson-2-9-release