我是 Scala 新手,所以我希望这个问题不要太天真。
假设我有一个 multi-module sbt-project并且项目之间存在依赖关系。
lazy val core = (project in file("core")).
settings( ... )
lazy val utils = (project in file("utils")).
settings( ... ).dependsOn(core)
问题是 .dependsOn(core)
意思是如果我这样做projects utils; compile
它将compile
core
事先(并使用其最新版本)?
我问这个,因为在实践中我没有看到这种行为(而且我想要它)。
最佳答案
您正在寻找aggregate
方法。像这样:
lazy val utils = (project in file("utils")).
settings( ... ).dependsOn(core).aggregate(core)
此处的聚合方法会导致在 utils
上运行的所有任务也在 core
上运行(更新等...)。如果您想禁用任务在聚合项目上运行,您可以查看 the documentation here
关于scala - sbt多模块项目: dependence between projects,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32063542/