在sbt 0.13.13

时间:2016-11-08 14:33:03

标签: scala sbt

我正在尝试在使用sbt 0.13.13时删除此设置的弃用警告

task <<=
 (streams in Test, 
  loadedTestFrameworks in Test, 
  testLoader in Test,
  testGrouping in Test in test, 
  testExecution in Test in task,
  fullClasspath in Test in test, 
  javaHome in test) flatMap Defaults.allTestGroupsTask


 warning: `<<=` operator is deprecated. 
  Use `key := { x.value }` or `key ~= (old => { newValue })`.
  See http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html

<<=运算符现已弃用,但我不知道如何重写上面的表达式。

我试图将其重写为:

task := Defaults.allTestGroupsTask(
  (streams in Test).value,
  (loadedTestFrameworks in Test).value,
  (testLoader in Test).value,
  (testGrouping in Test in test).value,
  (testExecution in Test in task).value,
  (fullClasspath in Test in test).value,
  (javaHome in test).value)

但我无法使用Task[A]

TaskKey分配给:=

我应该怎么做才能删除<<=呢?

1 个答案:

答案 0 :(得分:1)

尝试使用Def.taskDyn

task := Def.task {
  Def.task {
    Defaults.allTestGroupsTask(
      (streams in Test).value,
      (loadedTestFrameworks in Test).value,
      (testLoader in Test).value,
      (testGrouping in Test in test).value,
      (testExecution in Test in task).value,
      (fullClasspath in Test in test).value,
      (javaHome in test).value
    )
  }.value
}.value