[英]SBT aggregating subproject
Given a project structure: 给定一个项目结构:
rootProject
aggregatingSubProject
subA
subB
subC
How do I run the package
task for aggregatingSubProject
and all its aggregated projects, without specifying them by hand? 如何在不手动指定它们的情况下为aggregatingSubProject
及其所有聚合项目运行package
任务?
So far I can only have subA
and subB
built when doing package
in the rootProject
- regardless if I put .aggregate(subA, subB)
in aggregatingProject
's build.sbt
. 到目前为止,我只能subA
和subB
做时建package
在rootProject
-无论如果我把.aggregate(subA, subB)
在aggregatingProject
的build.sbt
。
I need the rootProject
to define common settings for the build and I want to build multiple projects (some aggregating other projects, like aggregatingSubProject
does) in a single build. 我需要rootProject
为构建定义通用设置,并且我想在一个构建中构建多个项目(一些聚合其他项目,例如aggregatingSubProject
)。
EDIT: I need to do this without specifying all the sub-sub-projects in the root build.sbt. 编辑:我需要在根build.sbt中不指定所有子项目的情况下执行此操作。 I'd like to define subA and subB in aggregatingSubProject/build.sbt. 我想在aggregatingSubProject / build.sbt中定义subA和subB。
Using sbt 0.13.16
. 使用sbt 0.13.16
。
Given this in build.sbt
: 在build.sbt
中build.sbt
:
val rootProject = project in file(".")
val aggregatingSubProject = project
val subC = project
and this in aggregatingSubProject/build.sbt
: 这在aggregatingSubProject/build.sbt
:
aggregateProjects(subA, subB)
val subA = project
val subB = project
You can run aggregatingSubProject/package
and get: 您可以运行aggregatingSubProject/package
并获取:
> aggregatingSubProject/package
[info] Updating {file:/s/t-subaggregate/}subB...
[info] Updating {file:/s/t-subaggregate/}aggregatingSubProject...
[info] Updating {file:/s/t-subaggregate/}subA...
[info] Done updating.
[info] Packaging /s/t-subaggregate/aggregatingSubProject/subA/target/scala-2.12/suba_2.12-0.1-SNAPSHOT.jar ...
[info] Done updating.
[info] Done packaging.
[info] Packaging /s/t-subaggregate/aggregatingSubProject/subB/target/scala-2.12/subb_2.12-0.1-SNAPSHOT.jar ...
[info] Done packaging.
[info] Done updating.
[info] Packaging /s/t-subaggregate/aggregatingSubProject/target/scala-2.12/aggregatingsubproject_2.12-0.1-SNAPSHOT.jar ...
[info] Done packaging.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.