不相容的杰克逊版本:2.7.1在sbt?

时间:2016-08-25 00:42:10

标签: scala jackson sbt finagle circe

从sbt:

运行TwitterServer时出现此错误
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

2.7杰克逊的依赖从其他地方(circe)传递过来。我以为我可以用这种方式将它覆盖到2.6.7,但似乎没有效果:

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`

知道为什么这不会覆盖任何东西吗?

1 个答案:

答案 0 :(得分:3)

看起来我也需要在这些覆盖上导入库依赖项,即使我没有直接使用它们:

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