使用 -deprecation 运行 SBT [英] Running SBT with -deprecation

查看:34
本文介绍了使用 -deprecation 运行 SBT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 project/build.scala 文件中似乎有警告(不在我的 SCALA 项目中).如何配置 SBT 以使用 -deprecation 标志运行.

I seem to have warnings in my project/build.scala file (NOT IN MY SCALA PROJECT). How do I configure SBT to run with the -deprecation flag.

// Does not help so do not suggest it!
scalacOptions ++= Seq("-unchecked", "-deprecation")

我知道 SBT 有 sbt.boot.properties 文件,但不知道该标志是否应该放在那里.如果它是一个例子会很好.提前谢谢.

I know that SBT has the sbt.boot.properties files, but can't figure out if the flag should go in there or not. And if it is an example would be nice. Thx in advance.

顺便说一句

我在 0.12.2 上使用 SBT 启动器,并且在 SBT 0.12.2 和 0.11.3 上都有问题.以防万一,我使用 Ubuntu.

I use SBT launcher for 0.12.2 and have the issue both with SBT 0.12.2 and 0.11.3. And I'm on Ubuntu in case that matters.

推荐答案

只需将 scalacOptions 设置放在 project/build.sbt 中.您的项目和构建定义的设置位于不同的文件中,因为在使用它们之前必须对其进行编译,并且由于您想要更改编译器设置,因此无法在同一文件中进行处理.

Simply put the scalacOptions setting in project/build.sbt. Settings for your project and your build definition go in different files, because they have to be compiled before they can be used and as you want to change compiler settings, this is not possible to handle in the same file.

edit:为了防止混淆,./build.sbtproject/build.scalaproject/build.sbt 是不同的.在第一个中,您可以放置​​项目的常规设置,在后两个中(切勿同时使用),您可以放置​​影响项目文件编译的设置.

edit: Just to prevent confusion, ./build.sbt, project/build.scala and project/build.sbt are different. In the first one you put your normal settings for the project and in the latter two (never both used together) you can put settings that affect the compilation of your project files.

这篇关于使用 -deprecation 运行 SBT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆