当我检测到一些不兼容的库时,我想让我的构建失败。我想出了类似的东西:
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
所以我重新定义测试失败,但它看起来有点过度设计。有一个更简单的解决方案吗?最好不要创建自定义任务。
答案 0 :(得分:1)
我假设您使用的是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