Important sbt commands

Run the below commands from the project's root directory

1. sbt run

To run the scala application.

2. sb update

To download the dependencies from the repository and update the application.

3. sbt assembly

To create a fat/uber jar of the scala application with all the dependencies.

Spark application to run on EMR requires a fat jar.

To remove conflicts while creating a fat jar, include below in the build.sbt

assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs @ _*) => MergeStrategy.discard
case x => MergeStrategy.first
}

4. sbt package

To create a thin jar without dependencies.


Follow the below steps to run sbt assembly 

1. Create "project" folder in the root folder of the project

2. Create "plugins.sbt" file in the above-created folder

3. Add below in the plugins.sbt

addSbtPlugin("com.eed3si9n" %% "sbt-assembly" % "0.14.10")

resolvers += Resolver.url("bintray-sbt-plugins",
url("http://dl.bintray.com/sbt/sbt-plugin-releases")) (Resolver.ivyStylePatterns)



Comments

Popular Posts