After switching to sbt-assembly 0.14.3, I ran into some problems and I could not fix them. Here is my BuildSettings.scala:
import sbt._ import Keys._ import sbtassembly.AssemblyPlugin.defaultShellScript object BuildSettings { lazy val basicSettings = Seq[Setting[_]]( organization := "com.my.project", version := "0.1.0-SNAPAHOT", description := "sample-project", scalaVersion := "2.11.7", scalacOptions := Seq("-deprecation", "-encoding", "utf8"), resolvers ++= Dependencies.resolutionRepos ) /* val shadeAssemblySettings = basicSettings ++ Seq( ShadeRule.rename("com.typesafe.config.**" -> " my_conf.@1 ") .inLibrary("com.typesafe" % "config" % "1.3.0") .inProject ) */ // sbt-assembly settings for building one fat jar lazy val sbtAssemblySettings = basicSettings ++ Seq( jarName in assembly := { name.value + "-" + version.value + ".jar" }, /* // Here we put all those libraries that we need to shade away from Spark provided libraries assemblyShadeRules in assembly := { ShadeRule.rename("com.typesafe.config.**" -> " my_conf.@1 ") .inLibrary("com.typesafe" % "config" % "1.3.0") .inProject }, */ mergeStrategy in assembly := { case m if m.toLowerCase.endsWith("manifest.mf") => MergeStrategy.discard case m if m.toLowerCase.matches("meta-inf.*\\.sf$") => MergeStrategy.discard case "log4j.properties" => MergeStrategy.discard case m if m.toLowerCase.startsWith("meta-inf/services/") => MergeStrategy.filterDistinctLines case "reference.conf" => MergeStrategy.concat case "application.conf" => MergeStrategy.concat case _ => MergeStrategy.first } /* // META-INF discarding mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) => { case "application.conf" => MergeStrategy.concat case PathList("META-INF", xs @ _*) => MergeStrategy.discard case x => MergeStrategy.first } */ //} ) // uncomment shi line if you want to include the config file as part of the jar!! //unmanagedResourceDirectories in Compile += { baseDirectory.value / "resources" } lazy val buildSettings = basicSettings ++ sbtAssemblySettings }
Here is what I have as assembly.sbt:
resolvers += Resolver.url("artifactory", url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns) addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")
Here's what my built .properties look like:
sbt.version=0.13.8
When I tried to execute un:
sbt clean assembly
I get the following errors:
[error] /Users/joe/Projects/project/BuildSettings.scala:31: not found: value jarName [error] jarName in assembly := { [error] ^ [error] /Users/joe/Projects/project/BuildSettings.scala:42: not found: value mergeStrategy [error] mergeStrategy in assembly := { [error] ^ [error] two errors found [error] (compile:compile) Compilation failed
Why is this?
source share