我是SBT的新手,不确定从evicted
任务:[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
完整的任务输出是...
sbt:Sprout> evicted
[info] Updating ...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn] * org.scala-lang.modules:scala-xml_2.12:1.1.0 is selected over 1.0.6
[warn] +- org.json4s:json4s-xml_2.12:3.6.3 (depends on 1.1.0)
[warn] +- org.scalatra:scalatra_2.12:2.6.5 (depends on 1.0.6)
[warn] +- com.typesafe.play:twirl-api_2.12:1.3.13 (depends on 1.0.6)
[info] Here are other dependency conflicts that were resolved:
[info] * org.json4s:json4s-core_2.12:3.6.5 is selected over 3.6.3
[info] +- org.json4s:json4s-jackson_2.12:3.6.5 (depends on 3.6.5)
[info] +- org.json4s:json4s-xml_2.12:3.6.3 (depends on 3.6.3)
[info] +- org.scalatra:scalatra-json_2.12:2.6.5 (depends on 3.6.3)
[info] * org.json4s:json4s-scalap_2.12:3.6.5 is selected over 3.6.3
[info] +- org.json4s:json4s-core_2.12:3.6.5 (depends on 3.6.5)
[info] +- org.json4s:json4s-core_2.12:3.6.3 (depends on 3.6.3)
[info] * org.json4s:json4s-ast_2.12:3.6.5 is selected over 3.6.3
[info] +- org.json4s:json4s-core_2.12:3.6.5 (depends on 3.6.5)
[info] +- org.json4s:json4s-core_2.12:3.6.3 (depends on 3.6.3)
[success] Total time: 1 s, completed Apr 13, 2019 12:53:54 PM
“怀疑二进制不兼容”听起来很严重。是吗?
是否只有一些排除项,我可以标记依赖项以获得关于正确版本的一致同意?
SBT依赖项就像...
libraryDependencies ++= Seq(
"org.scalatra" %% "scalatra" % ScalatraVersion exclude("org.slf4j","slf4j-api"),
"org.scalatra" %% "scalatra-scalatest" % ScalatraVersion % "test",
"org.slf4j" % "slf4j-api" % "1.7.26",
"ch.qos.logback" % "logback-classic" % "1.2.3" % "runtime",
"org.eclipse.jetty" % "jetty-webapp" % "9.4.9.v20180320" % "container",
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided",
"org.scalatra" %% "scalatra-json" % ScalatraVersion,
"org.json4s" %% "json4s-jackson" % "3.6.5",
)
答案 0 :(得分:5)
出现此警告是因为 public final Disposable forEachWhile(final Predicate<? super T> onNext, Consumer<? super Throwable> onError,
final Action onComplete)
和org.scalatra:scalatra_2.12:2.6.5
取决于com.typesafe.play:twirl-api_2.12:1.3.13
,但是org.scala-lang.modules:scala-xml_2.12:1.0.6
使用org.json4s:json4s-xml_2.12:3.6.3
要隐藏此警告,可以使用org.scala-lang.modules:scala-xml_2.12:1.1.0
:
dependencyOverrides
同样,它只会隐藏警告,但不能保证库与您设置的版本之间的兼容性。
答案 1 :(得分:2)
理想情况下,由于可能会引入难以跟踪的错误,因此,如果可能的话,我们应该解决隔离警告而不是覆盖警告。在这种情况下,我们可能愿意将json4s-jackson
和2.6.4
的版本分别降至3.5.2
和val ScalatraVersion = "2.6.4"
libraryDependencies ++= Seq(
"org.scalatra" %% "scalatra" % ScalatraVersion exclude("org.slf4j","slf4j-api"),
"org.scalatra" %% "scalatra-scalatest" % ScalatraVersion % "test",
"org.slf4j" % "slf4j-api" % "1.7.26",
"ch.qos.logback" % "logback-classic" % "1.2.3" % "runtime",
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided",
"org.scalatra" %% "scalatra-json" % ScalatraVersion,
"org.json4s" %% "json4s-jackson" % "3.5.2",
)
,就像这样:
{{1}}