我们可以在SBT项目中定义嵌套项目吗?

时间:2023-01-31 22:54:24

We can define multi projects in a SBT project, like:

我们可以在SBT项目中定义多个项目,例如:

lazy val core = project in file("core")
lazy val web = project in file("web")
lazy val shared = project in file("shared")

But is it possible to define nested projects inside a sub project? Like:

但是可以在子项目中定义嵌套项目吗?喜欢:

lazy val nested = project in file("nested")
lazy val nested1 = project in file("nested/nested1")
lazy val nested2 = project in file("nested/nested2")

When I run projects, it will show all defined projects in flat list:

当我运行项目时,它将在平面列表中显示所有已定义的项目:

> projects
[info] In file:/Users/twer/workspace/sbt-dependency-export-plugin-test/
[info]     core
[info]     nested
[info]     nested1
[info]     nested2
[info]   * root
[info]     shared
[info]     web

This is not what I expected, actually, I want it to be a tree, like:

这不是我的预期,实际上,我希望它是一棵树,如:

core
nested
   \-- nested1
   \-- nested2
root
shared
web

I want the nested1 and nested2 to be the sub projects of the nested, but not the whole project.

我希望nested1和nested2是嵌套的子项目,但不是整个项目的子项目。

Is it possible?

可能吗?

1 个解决方案

#1


projects will always just show the project ids in a list.

项目总是只在列表中显示项目ID。

But, I think, to do what you want you just need to do this:

但是,我认为,做你想做的事你只需要做到这一点:

lazy val nested = project in file("nested") aggregate (nested1, nested2)

#1


projects will always just show the project ids in a list.

项目总是只在列表中显示项目ID。

But, I think, to do what you want you just need to do this:

但是,我认为,做你想做的事你只需要做到这一点:

lazy val nested = project in file("nested") aggregate (nested1, nested2)