4

我在 Windows 机器上使用 sbt 0.13.7 和 Scala 2.11.4 将我的代码编译成一个胖 jar,我最终想在 Linux 机器上运行。

下面是我的 build.sbt 文件:

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)

我面临的错误是:

 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?
4

1 回答 1

4

您使用的是 sbt-assembly 0.12.0 吗?如果是这样,你就不需要assemblySettings更多了,因为它是一个自动插件

编辑

你必须包括

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

project/*.sbt喜欢project/assembly.sbt,不是build.sbt

于 2015-01-15T15:31:23.183 回答