I am writing a plugin that adds sets to the compile
task.
package myplugin
import sbt._
import Keys._
object MyPlugin extends AutoPlugin {
object autoImport {}
override lazy val projectSettings = Seq(
compile <<= compile.andFinally {
println("foo")
}
)
}
But when I use it in a project, I see
Reference to undefined setting:
*:compile from *:compile ((myplugin.MyPlugin) MyPlugin.scala:10)
Did you mean compile:compile ?
This will be useful in likely whatever context compiler is defined in (Compile
, Test
, etc.).
Changing compile
to (compile in Compile)
fixes the problem.
But explicitly listing the contexts will omit some, like ScctTest
(that's from the SCCT plugin, for code coverage).
Is there a way that I can define this operation for all contexts have a compile? Or am I trying to do something that goes against best practices?