使用如下的build.sbt文件:
ThisBuild / organization := "com.company"
ThisBuild / version := "1.0.0-SNAPSHOT"
ThisBuild / scalaVersion := "2.11.12"
Global / concurrentRestrictions += Tags.limit(Tags.Test, 1)
Global / scalacOptions ++= Seq("-Ypartial-unification",
"-unchecked",
"-Xfatal-warnings",
"-Ywarn-dead-code",
"-Ywarn-inaccessible",
"-Ywarn-unused",
"-Ywarn-unused-import",
"-Ywarn-macros:after")我在运行sbt clean compile后得到[error] bad option: '-Ywarn-macros:none'
如果不使用-Ywarn-macros:after,则未使用的导入警告将在使用Circe宏的文件中引发虚假警告,例如:import io.circe.{ Decoder, Encoder }。
发布于 2019-02-13 03:33:34
-Ywarn-macros直到Scala 2.12才被添加,所以错误是意料之中的。
你能升级到Scala 2.12吗?如果你被2.11卡住了,也许你需要离开-Ywarn-unused-import来生活。(由于Som Snytt在2.12.x系列上不知疲倦地工作,未使用的警告在总体上有了很大的改进。)
您可以将Circe-using代码限制在子项目中,然后仅在该子项目中禁用未使用的警告,以便在代码库的其余部分中保持启用状态。
另一种可能是尝试https://github.com/ghik/silencer。
https://stackoverflow.com/questions/54656043
复制相似问题