【发布时间】:2019-04-17 20:56:56
【问题描述】:
我知道,我看到了Run custom task automatically before/after standard task,但它似乎已经过时了。我还找到了SBT before/after hooks for a task,但它没有任何代码示例。
我在SBT 0.13.17。
所以我想在其他任务之后自动运行我的任务 MyBeforeTask 和 MyAfterTask,Compile 说。
所以当你做sbt compile 我想看看:
...log...
This is my before test text
...compile log...
This is my after test text
所以我需要:
object MyPlugin extends AutoPlugin {
object autoImport {
val MyBeforeTask = taskKey[Unit]("desc...")
val MyAfterTask = taskKey[Unit]("desc...")
}
import autoImport._
override def projectSettings: Seq[Def.Setting[_]] = {
MyBeforeTask := {
println("This is my before test text")
},
MyAfterTask := {
println("This is my after test text")
}
}
}
所以我想我需要像 dependsOn 和 in 这样的东西,但我不知道如何设置它们。
【问题讨论】: