sbt - SBT 项目定义文件的弃用和功能警告

标签 sbt

在编译我的 SBT 项目定义(即 project 目录中的文件)时,我收到了弃用和功能警告。 SBT 版本是 0.13.0。

我没有通过设置 scalacOptions := Seq("-feature", "-deprecation") 获得更多关于这些的信息,这似乎只适用于项目源文件而不适用于项目定义文件。

任何人都知道如何在编译项目定义时为编译器设置弃用和警告?

[info] Loading project definition from /home/xxx/website/project
[warn] there were 2 deprecation warning(s); re-run with -deprecation for details
[warn] there were 4 feature warning(s); re-run with -feature for details
[warn] two warnings found

最佳答案

创建 project/build.sbt具有以下内容的项目定义文件:

scalacOptions := Seq("-feature", "-deprecation")

由于任何 *.sbt文件下 project属于元(构建)项目,它为构建配置设置 Scala 编译器,而不是构建项目的环境。

它使用示例 sbt 多项目进行了测试:
[info] Compiling 1 Scala source to /Users/jacek/sandbox/so/multi-0.13.1/project/target/scala-2.10/sbt-0.13/classes...
[warn] /Users/jacek/sandbox/so/multi-0.13.1/project/Build.scala:4: method error in object Predef is deprecated: Use `sys.error(message)` instead
[warn]   lazy val e = error("Launcher did not provide the Ivy home directory.")
[warn]                ^
[warn] one warning found

...当它编译以下 project/Build.scala :
import sbt._

object Build extends Build {
  lazy val e = error("Launcher did not provide the Ivy home directory.")
}

关于sbt - SBT 项目定义文件的弃用和功能警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20931217/

相关文章:

未找到 scalacheck/scalatest : how to add it in sbt/scala?

scala - sbt 集成测试在测试失败时返回退出代码 0

scala - sbt 子项目的项目目录

scala - 如何将 sbt-assembly 中的非托管 JAR 添加到最终的胖 JAR?

scala - SBT docker :publish authentication issue

scala - 如何在 Play Framework 2.0.x scala 中使用 sbt-jslint?

scala - 如何在 Build.scala 中设置 sbt-proguard 插件

scala - 测试中的 SBT 清理 Hook

scala - 为什么AudioSystem.getMixerInfo()在sbt和Scala下返回不同的结果?

playframework - 为什么从 2.2.1 迁移到 2.3.1 时会出现 Unresolved 依赖关系?