【问题标题】:Is there a way in sbt to convert compiler warnings to errors so the build fails?sbt 中有没有办法将编译器警告转换为错误,因此构建失败?
【发布时间】:2021-04-07 20:40:17
【问题描述】:

我想“禁止”部分或全部编译器警告。

【问题讨论】:

标签: scala sbt


【解决方案1】:

您可以将选项从 sbt 传递给 scala 编译器,包括将警告转化为错误的选项。

我通常会添加这些:

scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature", "-Xfatal-warnings"),

【讨论】:

    【解决方案2】:

    根据scalac options documentation,您可以通过-Werror 或-Xfatal-warnings。
    您可以在 sbt 中通过附加到 scalacOptions 来做到这一点。

    scalacOptions += "-Werror"
    

    【讨论】:

      【解决方案3】:

      【讨论】:

        猜你喜欢
        • 2020-10-21
        • 1970-01-01
        • 2012-02-29
        • 2020-10-27
        • 1970-01-01
        • 2020-03-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多