Search code examples
scalasbtsbt-assembly

sbt: how to merge multiple jars


Is there a way to use sbt to just merge (assembly) multiple jars in one jar.

Let say I have:

  • src (empty)
  • lib/lib1.jar
  • lib/lib2.jar

and I want:

  • target/all.jar

Maybe there are some other tools to make that for example using zip to aggregate archives but I think sbt does some useful checks during assembly.


Solution

  • SBT has an assembly plugin:

    https://github.com/sbt/sbt-assembly

    You should be able to add your static lib/ jars as dependencies then the assembly plugin can wrap it all up into one jar.