I would like to know when should I use sbt assembly and when sbt compile && sbt package?
I'm coding a program in my local computer using Intellij IDEA and I'm compiling it with sbt compile && sbt package, then I'm going to upload it to a cluster and run it using spark-submit. Is this the best way? When should I use sbt assembly?
I would like to know when should I use
sbt assemblyand whensbt compile && sbt package?
Quoting sbt-assembly's website (which gives sbt assembly):
The goal is simple: Create a fat JAR of your project with all of its dependencies.
Any dependency in build.sbt (that is not marked as Provided) is going to be part of the final jar file that is called an uber-jar.
There are at least two reasons why you'd like to use the plugin:
spark-submit from Spark 1.6.0You use sbt compile && sbt package to compile and package the classes of your application (which by the way does not have to use Spark whatsoever). That jar file does not include the dependencies of your application so any dependencies have to be provided in some other way (and makes deployment a bit tricker).
NB: sbt compile && sbt package is just a longer variant of sbt compile package which given that compile task is a dependency of package is just sbt package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With