如何在 sbt 中添加对更新阶段的依赖?
问题描述:
我正在编写一个 sbt 任务,它需要在任何编译发生之前做一些工作(例如在 update
阶段).
I am writing an sbt task which needs to do some work before any compilation takes place (e.g. in the update
phase).
如果我在编译特定项目之前添加依赖项,我会这样做:
If I were adding a dependency before the compile for a specific project, I'd do this:
project settings (
compile <<= (compile in Compile) dependsOn myTask
)
如果我想在 update
之前这样做,我会这样做
and if I wanted to do this before update
I'd do
project settings (
update <<= (update in Compile) dependsOn myTask
)
但是我如何在 after update
但在任何 compile
之前执行此操作?
but how do I do this for after update
but before any compile
?
答
试试这个:
(update in Compile) := {
((update in Compile) andFinally {
myTask.value
}).value
}