I am having trouble getting SBT Subprojects to recognize the commands provided by the plugins. I have the following plugin source:
object DemoPlugin extends AutoPlugin { override lazy val projectSettings = Seq(commands += demoCommand) lazy val demoCommand = Command.command("demo") { (state: State) => println("Demo Plugin!") state } }
which is used by a project configured as follows:
lazy val root = project in file(".") lazy val sub = (project in file("sub")). enablePlugins(DemoPlugin). settings( //... )
The plugin, of course, is specified in project/plugins.sbt . However, when I open sbt in the project, I see the following:
> sub/commands [info] List( sbt.SimpleCommand@413d2cd1 ) > sub/demo [error] Expected ':' (if selecting a configuration) [error] Not a valid key: demo (similar: doc) [error] sub/demo
Even a stranger, using consoleProject , I see that the command in the project is the one defined by DemoPlugin !
scala> (commands in sub).eval.map { c => c.getClass.getMethod("name").invoke(c) } res0: Seq[Object] = List(demo)
I am looking to be able to type sub/demo and execute the demo command. Any help would be greatly appreciated!
source share