Search code examples
scalasbtsbt-assemblysbt-native-packagersbt-plugin

Package fat jar into a debian using sbt native packaging


On running "sbt debian:packageBin" command, the fakeroot program fails since it tries to look for the fat jar (assembly) in /target dir instead of /target/scala-2.11/ directory.

So, is there a setting to specify the source directory for debian packaging using sbt Debian plugin?

SBT version: 0.13.11 Added below in plugins.sbt: addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.4")

In build.sbt, have added below: lazy val root = (project in file(".")). enablePlugins(DebianPlugin)


Solution

  • I think you are mixing a few things up here. SBT native-packager and sbt-assembly solve both the same problem ( creating something you can deploy ), but in different ways.

    how to fix your issue with native-packager

    Check out the installation section in the reader, which states:

    enablePlugins(JavaAppPackacking)
    

    This configures your build to create JVM application packages. You can now run sbt Debian:packageBin.

    sbt assembly

    You'll have to create the debian package yourself. Assembly only generates a fat jar.

    Cheers, Muki