2

My main project needs to generate a sub-project with its own build.sbt and then compile and use the sub-project. If the sub-project was pre-generated, I could reference it from the main build.sbt with RootProject. But if the sub-project is not yet generated, any attempt to use a value of lazy val sub = RootProject(subBaseDir) fails.

Is it possible to load the sub-project that does not exist at the moment of sbt start, so some tasks of the main project depended of the sub-project?

Konstantin Pelepelin
  • 1,303
  • 1
  • 14
  • 29
  • Note this question is different from http://stackoverflow.com/questions/30942220/sbt-dynamic-aggregation-of-subproject where all sub-projects do exist at the moment of sbt start, and just need to be discovered. – Konstantin Pelepelin Nov 29 '16 at 15:00

1 Answers1

0

Yes, it should be possible in SBT 0.13.13 using its new feature called "Synthetic subprojects". You won't have a build.sbt file for such synthetic projects, since they're, well, completely synthetic. But otherwise they're completely functional projects, and you should be able to set up the dependencies between tasks of current project and its derived projects.

Disclaimer: I haven't tried this new feature myself yet.

Haspemulator
  • 11,050
  • 9
  • 49
  • 76