I have a single scala project built with sbt using a build.scala file. I can use sbt-assembly to generate a single executable jar file from this project without problem. Now I want to generate multiple executable jar files, where each file includes a common set of internal and external base dependencies along with different external dependencies.
Is this possible with the current version of sbt-assembly? In maven this is easy, as one can define multiple profiles in the pom, each generating a separate jar, but in sbt-assembly you pass the assembly settings to your project and I haven't figured out a way to modify the settings to generate multiple jar files.
The concept of Maven profile translates in sbt/Ivy as configuration. You can define settings within a configuration and have sbt-assembly generate two jars. You can add libraryDependency to a specific configuration by adding
% "config"
. This, however requires the project to be aware of the configuration(s) upfront.In
build.sbt
(requires sbt 0.13.0 or above):To run assembly task within the configuration, you'd say: