I have a project, called Main
, and 2 subprojects: One
, Two
. Here's what my build.sbt
looks like:
name := "Main"
version := "0.1"
scalaVersion := "2.12.7"
lazy val root = Project(id = "root", base = file(".")) aggregate(one, two) dependsOn(one, two)
lazy val one = Project(id = "one", base = file("One"))
lazy val two = Project(id = "two", base = file("Two"))
when I run sbt compile package
I only get a .jar
for Main
(Main.jar
), but I want to get a .jar
for every subproject and not Main
: One.jar
, Two.jar
.
How do I achieve this?
Also I have no idea what aggregate(one, two) dependsOn(one, two)
means, do I even need that?
I also want every subproject to build into a fat jar with sbt-assembly
.
It actually works now. I was encountering this behavior, where sbt was telling me that my assembly was not packaged, because it was up-to-date, but then I started doing sbt clean assembly
, instead of sbt assembly
and it works like a charm now.