如何克服 "There may be incompatibilities..." SBT 警告?
How do I overcome "There may be incompatibilities..." SBT warning?
我是 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
"suspected binary incompatible" 听起来很严肃。是吗?
是否只有一些排除项我可以标记到依赖项上以使依赖项就正确的版本达成一致?
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",
)
出现此警告是因为 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
:
dependencyOverrides += "org.scala-lang.modules" % "scala-xml_2.12" % "1.0.6"
同样,它只会隐藏警告,但不能保证您的库与您设置的版本之间的兼容性。
理想情况下,如果可能的话,我们应该解决 evection 警告而不是覆盖,因为可能会引入难以追踪的错误。在这种情况下,如果我们愿意将 scalatra
和 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",
)
我是 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
"suspected binary incompatible" 听起来很严肃。是吗?
是否只有一些排除项我可以标记到依赖项上以使依赖项就正确的版本达成一致?
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",
)
出现此警告是因为 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
:
dependencyOverrides += "org.scala-lang.modules" % "scala-xml_2.12" % "1.0.6"
同样,它只会隐藏警告,但不能保证您的库与您设置的版本之间的兼容性。
理想情况下,如果可能的话,我们应该解决 evection 警告而不是覆盖,因为可能会引入难以追踪的错误。在这种情况下,如果我们愿意将 scalatra
和 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",
)