Skip to content

Instantly share code, notes, and snippets.

@cloudcalvin
Created August 25, 2015 20:07
Show Gist options
  • Select an option

  • Save cloudcalvin/73c391113df9838302e1 to your computer and use it in GitHub Desktop.

Select an option

Save cloudcalvin/73c391113df9838302e1 to your computer and use it in GitHub Desktop.
SBT Assembly build settings to allow Spark App to work in jar. Just add to your current settings
assemblyMergeStrategy in assembly := {
case PathList("javax", "servlet", xs @ _*) => MergeStrategy.last
case PathList("javax", "activation", xs @ _*) => MergeStrategy.last
case PathList("org", "apache", xs @ _*) => MergeStrategy.last
case PathList("com", "google", xs @ _*) => MergeStrategy.last
case PathList("com", "esotericsoftware", xs @ _*) => MergeStrategy.last
case PathList("com", "codahale", xs @ _*) => MergeStrategy.last
case PathList("com", "yammer", xs @ _*) => MergeStrategy.last
case "about.html" => MergeStrategy.rename
case "META-INF/ECLIPSEF.RSA" => MergeStrategy.last
case "META-INF/mailcap" => MergeStrategy.last
case "META-INF/mimetypes.default" => MergeStrategy.last
case "plugin.properties" => MergeStrategy.last
case "log4j.properties" => MergeStrategy.last
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
libraryDependencies ++= Seq(
("org.apache.spark" %% "spark-core" % "1.4.1").
exclude("org.mortbay.jetty", "servlet-api").
exclude("commons-beanutils", "commons-beanutils-core").
exclude("commons-collections", "commons-collections").
exclude("commons-logging", "commons-logging").
exclude("com.esotericsoftware.minlog", "minlog")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment