1

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

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.

Is it possible?

Freewind
  • 193,756
  • 157
  • 432
  • 708

1 Answers1

4

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

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

lazy val nested = project in file("nested") aggregate (nested1, nested2)
Dale Wijnand
  • 6,054
  • 5
  • 28
  • 55
  • for more details you can refer: https://pbassiner.github.io/blog/defining_multi-project_builds_with_sbt.html – linehrr Jan 17 '19 at 18:43