如何在sbt中"重新运行-deprecation for details"?

Kaj*_*nus 167 sbt

当我编译Scala代码时,通过运行sbt compile,SBT说:

$ sbt compile
...
[warn] there were 5 deprecation warnings; re-run with -deprecation for details
...
Run Code Online (Sandbox Code Playgroud)

我怎么做?(从SBT内部?)

Eug*_*ota 216

如果你不想改变你的build.sbt:

$ sbt
> set scalacOptions in ThisBuild ++= Seq("-unchecked", "-deprecation")
> compile
> exit
Run Code Online (Sandbox Code Playgroud)

编辑:添加in ThisBuildset评论.

  • @retronym:`in Global`而不是`in ThisBuild`也适用于子项目 - 但为什么后者更受欢迎?还是它甚至? (2认同)

San*_*hit 23

scalacOptions := Seq("-unchecked", "-deprecation")
Run Code Online (Sandbox Code Playgroud)

将此设置添加到build.sbt,如果您有多模块项目,请将其添加到每个项目的设置中.