【发布时间】:2019-01-28 22:00:05
【问题描述】:
我的 .sbt 文件如下所示:
lazy val common = (project in file("./common"))
.settings(
// other settings
)
lazy val one = (project in file("./one"))
.dependsOn(common)
.settings(
// other settings
addCommandAlias("build", ";clean;assembly;foo")
)
lazy val two = (project in file("./two"))
.dependsOn(common)
.settings(
// other settings
addCommandAlias("build", ";clean;compile;bar")
)
此外,我还有两个任务 foo 和 bar 仅在各自的项目中有效。
我的测试表明,在调用 build 时 - 无论我在哪个项目中 - 都会调用两个别名。
对于任务,键只能在 .sbt 文件的顶层定义(例如val foo = taskKey[Unit]("Does foo"))。
我想知道如何在项目级别正确实现任务和命令别名。
这可能吗?
【问题讨论】: