Disable aggregate for sbt custom task

2019-09-09 13:33发布

问题:

How can I disable aggregate for a single custom task?

I tried to add the following to my build.sbt:

aggregate in myTaskName:= false

But it doesn't work as I expected - I've got this error:

~\build.sbt:1: error: not found: value myTaskName
aggregate in myTaskName:= false 

回答1:

Working example (sbt 0.13.5):

val hello = TaskKey[Unit]("hello", "Prints 'Hello Zhu'")

val helloTask = hello := {
  println("Hello Zhu")
}

aggregate in hello := false

Note, that TaskKey was used - not the Setting[Task] itself. It worth additional notice that this key should be accessable from your build.sbt and, as @Mark Harrah mentioned, hello must be fully-qualified.



标签: scala sbt