Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 存在不兼容的逐出时sbt生成失败_Scala_Sbt - Fatal编程技术网

Scala 存在不兼容的逐出时sbt生成失败

Scala 存在不兼容的逐出时sbt生成失败,scala,sbt,Scala,Sbt,当检测到一些不兼容的库时,我希望使生成失败。我想出了这样的办法: test := Def.sequential( Def.task { if (evicted.value.reportedEvictions.nonEmpty) { throw new IllegalStateException("There are some incompatible classpath evictions warnings. You can suppress them with depe

当检测到一些不兼容的库时,我希望使生成失败。我想出了这样的办法:

test := Def.sequential(
  Def.task {
    if (evicted.value.reportedEvictions.nonEmpty) {
      throw new IllegalStateException("There are some incompatible classpath evictions warnings. You can suppress them with dependencyOverrides setting.")
    } 
  },
  test in Test
).value

所以我重新定义测试失败,但它看起来有点设计过度。有更简单的解决方案吗?最好不创建自定义任务。

我假设您使用的是sbt 1.x,因此我认为正确的方法是:

lazy val myTask = taskKey[Unit]("This is the tasks that checks that everything is ok before you start your tests")

myTask := ???

(test in Test) := (test in Test).dependsOn(myTask).value

sbt的哪个版本?