Since the selected answer, the related documentation has changed, the answer is no longer so clear.
In the build.sbt OP main_project , in order to put them together, they will have to define aggregate , as the new (er) documentation refers to:
lazy val root = (project in file(".")) .aggregate(util, core) lazy val util = (project in file("util")) lazy val core = (project in file("core"))
And then running sbt compile in the project root directory will compile them all.
However, if you want to compile one at a time, you can go to the cmd line / terminal to the root project (here main_project ) and then run the following command:
user:main_project$: sbt <project name> / compile
use an example poster:
user:main_project$: sbt sub_project1 / compile
(if you are in the SBT terminal, you can omit sbt )
source share