Search code examples
sbtsbteclipse

SBT Eclipse not generating projects for aggregating sub-projects


Assume a hierarchical project layout as the following:

root
 -subproject1
 -subproject2

where root only aggregates all subprojects.

Calling eclipse in root, as expected, generates importable eclipse projects for all subprojects.

However, now consider that subproject 1 also aggregates subproject 2. Calling the eclipse task in either root or subproject 1 generates project files for all but subproject 1. In summary, having an "aggregation graph" such as

      -> subproject1
    /        |
root         |
    \        v
      -> subproject2

never generates eclipse files for subproject 1.

Am I missing something about aggregation semantics or is this a bug in sbteclipse?

A concrete case where this problem occurs can be found in the build file here. Project "vfd-main" never has any eclipse projects generated unless removing its own aggregation settings on line 58. Btw, I am using sbteclipse version 3.0.0


Solution

  • It turns out this is the expected behavior. Since subproject1 aggregates other projects, it is considered a parent and, by default, no project definitions are generated for parents. This can be changed by adding

    EclipseKeys.skipParents in ThisBuild := false
    

    to the build.