小编典典

如何在 sbt 中“使用 -deprecation 重新运行以获取详细信息”?

all

当我通过运行编译 Scala 代码时sbt compileSBT说:

$ sbt compile
...
[warn] there were 5 deprecation warnings; re-run with -deprecation for details
...

我怎么做?(来自 SBT 内部?)


阅读 74

收藏
2022-08-08

共1个答案

小编典典

sbt 外壳

在 sbt shell 中(如果你不想改变你的build.sbt):

$ sbt
> set ThisBuild/scalacOptions ++= Seq("-unchecked", "-deprecation")
> compile
> exit

由于in ThisBuild,set也将设置应用于所有子项目。

命令行

您也可以在命令行上将上述内容作为单个命令运行。

sbt '; set ThisBuild/scalacOptions ++= Seq("-unchecked", "-deprecation") ; compile'

诀窍是使用;(分号) 分隔命令和'(ticks) 将所有- 分隔;的命令作为 sbt 的单个参数包含在内。

sbt < 1.x

而不是ThisBuild/scalacOptions使用scalacOptions in ThisBuild

2022-08-08