mikebridge mikebridge - 3 months ago 17
Scala Question

Incompatible Jackson version: 2.7.1 in sbt?

I'm getting this error when running TwitterServer from sbt:

SEVERE: LoadService: failed to
instantiate 'com.twitter.finagle.stats.MetricsExporter'
for the requested service 'com.twitter.finagle.http.HttpMuxHandler'
com.fasterxml.jackson.databind.JsonMappingException:
Incompatible Jackson version: 2.7.1


The 2.7 Jackson dependency is being pulled in transitively from elsewhere (circe). I thought I could override it to 2.6.7 this way, but it seems to have no effect:

val jacksonV = "2.6.7"
val `jackson-core` = "com.fasterxml.jackson.core" % "jackson-core" % jacksonV
val `jackson-databind` = "com.fasterxml.jackson.core" % "jackson-databind" % jacksonV
val `jackson-annotations` = "com.fasterxml.jackson.core" % "jackson-annotations" % jacksonV
val `jackson-datatype-jsr310` = "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % jacksonV
dependencyOverrides += `jackson-core`
dependencyOverrides += `jackson-databind`
dependencyOverrides += `jackson-annotations`
dependencyOverrides += `jackson-datatype-jsr310`


Any idea why this doesn't override anything?

Answer

It looks like I need to import the library dependencies on those overrides too, even if I'm not using them directly:

libraryDependencies ++= Seq(
    `jackson-databind`,
    `jackson-core`,
    `jackson-annotations`,
    `jackson-datatype-jsr310`,
    // ...
)