【问题标题】:Re-run with -feature for details使用 -feature 重新运行以获取详细信息
【发布时间】:2014-07-18 13:20:34
【问题描述】:

当我在游戏控制台中编译 scala 时,我得到了这个:

[warn] there were 1 feature warning(s); re-run with -feature for details
[warn] one warning found

我以为是compile -feature,但我明白了:

[error] Expected ID character
[error] Not a valid command: compile (similar: completions)
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Expected '::'
[error] Expected end of input.
[error] compile -feature
[error]     

然后我运行play -feature,我得到了这个:

[warn] The `-` command is deprecated in favor of `onFailure` and will be removed in 0.14.0

然后退出游戏。

那我该怎么做呢?

【问题讨论】:

    标签: scala playframework


    【解决方案1】:

    你必须添加

    scalacOptions += "-feature"
    

    到你的build.sbt,如果你的 sbt 控制台正在运行(或重新启动它),则执行reload

    或者,如果您只想在 sbt 控制台中为单个会话设置它。

    set scalacOptions += "-feature"
    

    你可以写,这个设置是立即应用的,不需要重新加载或重启sbt控制台。

    【讨论】:

      【解决方案2】:

      如果你在 play/sbt repl 中,为了完成,你可以为会话修改 scalacOptions 的值,如下所示:

      【讨论】:

      • 我收到了同样的警告,并更改了 cmets 中提到的 scala 选项。但是我无法摆脱警告。这个错误的根本原因是什么?
      • 同样的问题 :(
      【解决方案3】:

      就我而言,我在 /usr/local/etc/sbtopts 文件中找到了错误的来源。我安装的某个程序在最后添加了以下行。

      -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled XX:MaxPermSize=256M
      

      每当 sbt 启动时,上述行作为导致上述错误的参数传递。由于这些是解决它的 java 选项,我们可以在上述行之前添加 -J 或完全删除该行。这摆脱了-feature。

      【讨论】:

      • 对我来说,这是在 IntelliJ 编译器选项中,甚至不在 SBT 配置中,但它相当于同一件事。谢谢指点!
      【解决方案4】:

      该标志需要添加到 Scala 编译器选项中。您可以通过将以下行添加到您的 build.sbt 文件中来做到这一点:

      scalacOptions ++= Seq("-feature")
      

      【讨论】:

      • 知道这个标志的作用吗?
      猜你喜欢
      • 2015-03-09
      • 2014-07-18
      • 2012-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-23
      • 2021-02-28
      • 1970-01-01
      相关资源
      最近更新 更多