每当我们使用像"sbt compile"或"sbt assembly"这样的sbt命令时,我都想运行一个脚本。
有没有办法做到这一点?
将步骤附加到任务的过程类似于以下内容:
compile <<= (compile in Compile) map {result =>
// whatever you want to do after compile here.
result
}
如果要定义运行脚本的自定义Command
,请在生成中定义类似于
def myCommand = Command.command("myCommand") { state =>
s"<relative path to script here>" !; state
}
然后,您将myCommand
添加到要myCommand
运行的每个任务中。