Can sbt execute "compile test:compile it:compile" as a single command, say "*:compile"?

sbt

Solution

`test:compile` implies a `compile` so `compile` doesn't need to be explicitly run before `test:compile`. If your `IntegrationTest` configuration `extend`s `Test`, `it:compile` implies `test:compile`.

One option is to define an alias that executes multiple commands:

sbt> alias compileAll = ; test:compile ; it:compile

See `help alias` and `help ;` for details. You can make this a part of your build with:

addCommandAlias("compileAll", "; test:compile ; it:compile")

The other option is to define a custom task that depends on the others and call that:

lazy val compileAll = taskKey[Unit]("Compiles sources in all configurations.")

compileAll := { 
   val a = (compile in Test).value
   val b = (compile in IntegrationTest).value
   ()
}

Problem

I'm running `compile test:compile it:compile` quite often and...would like to cut the number of keystrokes to something like `*:compile`. It doesn't seem to work, though. ``` $ sbt *:compile [info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins [info] Loading project definition from /Users/jacek/oss/scalania/project [info] Set current project to scalania (in build file:/Users/jacek/oss/scalania/) [error] No such setting/task [error] *:compile [error] ^ ``` Is it possible at all? I use SBT 0.13.

Original source