gpt4 book ai didi

scala - 编译Build.scala时如何设置SBT使用的scalacOptions?

转载 作者:行者123 更新时间:2023-12-04 07:53:40 26 4
gpt4 key购买 nike

我在试图弄清楚如何设置/附加到 scalacOptions 时遇到了一些麻烦SBT 编译时使用 Build.scala .我团队中有人从 Akka 的 Build.scala 中复制了一些代码结果是一堆已弃用的警告和功能警告。

$ reload
[info] Loading global plugins from /Users/xxx/.sbt/0.13/plugins
[info] Loading project definition from /Users/xxx/yyy/zzz/project
[info] Compiling 1 Scala source to /Users/xxx/yyy/zzz/project/target/scala-2.10/sbt-0.13/classes...
[warn] there were 3 deprecation warning(s); re-run with -deprecation for details
[warn] there were 1 feature warning(s); re-run with -feature for details
[warn] two warnings found

我尝试过的事情
  • 添加 scalacOptions ++= Seq("-unchecked", "-feature")build.sbt .我希望它会在 Build.scala 之前加载被编译。
  • 已有 scalacOptions ++= Seq(...., "-unchecked", "-feature")Build.scala
  • 尝试设置 scalacOptions之前 reload但它似乎被丢弃了
    $ ;set scalacOptions ++= Seq("-feature", "-deprecated") ;reload
    [info] Defining zzz/*:scalacOptions
    [info] The new value will be used by zzz/compile:scalacOptions
    [info] Reapplying settings...
    [info] Set current project to zzz (in build file:/Users/xxx/yyy/zzz/)
    [info] Loading global plugins from /Users/xxx/.sbt/0.13/plugins
    [info] Loading project definition from /Users/xxx/yyy/zzz/project
    [info] Compiling 1 Scala source to /Users/xxx/yyy/zzz/project/target/scala-2.10/sbt-0.13/classes...
    [warn] there were 3 deprecation warning(s); re-run with -deprecation for details
    [warn] there were 1 feature warning(s); re-run with -feature for details
    [warn] two warnings found
    [warn] Discarding 1 session setting. Use 'session save' to persist session settings.

  • 通过大量的汗水,我能够找到已弃用警告的原因,但我找不到功能警告的原因。

    最佳答案

    Sbt is recursive ,这意味着 Build.scalaproject目录由其父目录或 build.sbt 中的另一个定义构建在 project目录。

    因此你必须创建 build.sbtproject目录。在 project/build.sbt你应该可以设置 scalacOptions ++= Seq("-unchecked", "-feature") .

    关于scala - 编译Build.scala时如何设置SBT使用的scalacOptions?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24289776/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com