Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are key differences between sbt-pack and sbt-assembly?

I've just stumbled upon the sbt-pack plugin. The development stream seems steady. It's surprising to me as I believed that the only plugin for (quoting sbt-pack's headline) "creating distributable Scala packages." is sbt-assembly (among the other features).

What are the key differences between the plugins? When should I use one over the other?

like image 211
Jacek Laskowski Avatar asked Mar 21 '14 10:03

Jacek Laskowski


People also ask

What is assembly in sbt?

sbt-assembly creates a fat JAR - a single JAR file containing all class files from your code and libraries. By evolution, it also contains ways of resolving conflicts when multiple JARs provide the same file path (like config or README file).

What does sbt stage do?

The stage command is part of sbt-native-packager that: The goal [of the plugin] is to be able to bundle up Scala software built with SBT for native packaging systems, like deb, rpm, homebrew, msi. > help stage Create a local directory with all the files laid out as they would be in the final distribution.

What is sbt Dist?

The dist task builds a binary version of your application that you can deploy to a server without any dependency on sbt, the only thing the server needs is a Java installation.


Video Answer


1 Answers

(Disclaimer: I maintain sbt-assembly)

sbt-assembly

sbt-assembly creates a fat JAR - a single JAR file containing all class files from your code and libraries. By evolution, it also contains ways of resolving conflicts when multiple JARs provide the same file path (like config or README file). It involves unzipping of all library JARs, so it's a bit slow, but these are heavily cached.

sbt-pack

sbt-pack keeps all the library JARs intact, moves them into target/pack directory (as opposed to ivy cache where they would normally live), and makes a shell script for you to run them.

sbt-native-packager

sbt-native-packager is similar to sbt-pack but it was started by a sbt committer Josh Suereth, and now maintained by highly capable Nepomuk Seiler (also known as muuki88). The plugin supports a number of formats like Windows msi file and Debian deb file. The recent addition is a support for Docker images.

All are viable means of creating deployment images. In certain cases like deploying your application to a web framework etc., it might make things easier if you're dealing with one file as opposed to a dozen.

Honorable mention: sbt-progard and sbt-onejar.

like image 125
Eugene Yokota Avatar answered Oct 20 '22 01:10

Eugene Yokota