I'm looking to create jars for AWS Lambda to run job tasks. Currently my build.sbt file looks something like this:
lazy val commonSettings = Seq(...)
lazy val core = project
.settings(commonSettings: _*)
lazy val job = project
.settings(commonSettings: _*)
.dependsOn(core)
lazy val service = project
.settings(commonSettings: _*)
.settings(
mainClass in assembly := Some("io.example.service.Lambda"),
assemblyJarName in assembly := "lambda.jar"
)
.dependsOn(core)
Running sbt assembly
assembles the service
module into a jar for my API and that works fine. The module job
however will have multiple Main
classes (one pr. job) and when I run sbt assembly job
the service
module is also assembled (even through its not depended on).
How can I configure my setup to only assemble the job
module when needed, and specify individual mainClasses as separately assembled jars?
Set mainClass in assembly
in job
to define which main class to use, and run job/assembly
to just assemble the job assembly jar.