如何在 sbt 中添加对更新阶段的依赖? [英] How to add a dependency on the update stage in sbt?

查看:32
本文介绍了如何在 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
}

这篇关于如何在 sbt 中添加对更新阶段的依赖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆