【问题标题】:SBT: is it wise to fix eviction warnings of library dependenciesSBT:修复库依赖项的驱逐警告是否明智
【发布时间】:2017-02-28 22:54:56
【问题描述】:

修复 SBT 驱逐警告消息是个好主意吗?

通过将被驱逐的库的版本覆盖到最新版本。这会迫使 SBT 终生使用被覆盖的版本吗? SBT 还会通知我们将来有更新的版本吗?

驱逐警告示例 (SBT 0.13.13)

[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn]  * com.chuusai:shapeless_2.11:1.2.4 -> 2.3.2
[warn]  * org.postgresql:postgresql:9.4-1201-jdbc41 -> 9.4.1208.jre7
[warn]  * jline:jline:0.9.94 -> 2.12.1
[warn] Run 'evicted' to see detailed eviction warnings

通过在 build.sbt 的末尾添加来删除警告。按照 SBT 文档中的说明Eviction warning

dependencyOverrides ++= Set(
  "org.postgresql" % "postgresql" % "9.4.1208.jre7",
  "com.chuusai" %% "shapeless" % "2.3.2",
  "jline" % "jline" % "2.12.1"
)

【问题讨论】:

    标签: scala sbt


    【解决方案1】:

    如果这些警告是针对您在代码中直接使用的依赖项,您绝对应该将升级版本添加到您的libraryDependencies

    对于逐出的传递依赖项(那些依赖项仅由您自己的依赖项直接使用),最好将警告留在原处。这为您提供了有关您的依赖项中可能存在的不兼容性的文档,并且可以帮助您调试由于此类不兼容性而出现的运行时问题。

    请记住,设置 dependencyOverrides 只会隐藏警告,并不能保证您的库与您设置的版本之间的兼容性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-28
      • 2015-08-16
      • 1970-01-01
      • 1970-01-01
      • 2016-04-06
      • 2014-12-24
      • 2023-03-11
      • 1970-01-01
      相关资源
      最近更新 更多