Varun
Varun

Reputation: 93

Scala code build with sbt assembly , failing

I am using sbt 0.13.7 and Scala 2.11.4 on a Windows machine to compile my code into a fat jar, that I eventually want to run on a Linux machine.

Below is my build.sbt file:

import AssemblyKeys._

name := "Simple Project"
version := "1.0"
organization := "com.myorg"
scalaVersion := "2.11.4"
libraryDependencies ++= Seq(
  // Spark dependency
  "org.apache.spark" % "spark-core_2.10" % "1.2.0" % "provided",
  // Third party libraries
  "net.sf.jopt-simple" % "jopt-simple" % "4.3",
  "joda-time" % "joda-time" % "2.0"
)
libraryDependencies += Defaults.sbtPluginExtra("com.eed3si9n" % "sbt-assembly" % "0.7.2", "0.11.2", "2.9.1")
// This statement includes the assembly plugin capabilities
assemblySettings
// Configure jar named used with the assembly plug-in
jarName in assembly := "my-project-assembly.jar"
// A special option to exclude Scala itself form our assembly jar, since Spark
// already bundles Scala.
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)

The error I am facing is:

 build.sbt:16: error: type mismatch;
 found   : Seq[sbt.Project.Setting[_]]
 required: sbt.internals.DslEntry
assemblySettings
^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?

Upvotes: 4

Views: 4241

Answers (1)

Eugene Yokota
Eugene Yokota

Reputation: 95654

Are you using sbt-assembly 0.12.0? If so, you don't need assemblySettings any more since it's an auto plugin.

Edit:

You have to include

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

in project/*.sbt like project/assembly.sbt, not build.sbt.

Upvotes: 4

Related Questions