assemblyMergeStrategy类型错误

时间:2017-08-09 18:36:04

标签: scala sbt

我正在尝试建立一个小项目,用scala编写一个aws-lambda:

javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint")

lazy val root = (project in file(".")).
  settings(
    name := "xxx",
    version := "0.1",
    scalaVersion := "2.12.3",
    retrieveManaged := true
  )

libraryDependencies ++= Seq(
  "com.amazonaws" % "aws-lambda-java-core"   % "1.1.0" % Provided,
  "com.amazonaws" % "aws-lambda-java-events" % "1.1.0" % Provided,
  "org.scalatest" % "scalatest" % "2.2.6" % Test
)

scalacOptions += "-deprecation"

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

结果:

  

xxx / build.sbt:25:错误:未找到:值assemblyMergeStrategy   assemblyMergeStrategy in assembly&lt;&lt; =(assemblyMergeStrategy in   assembly){^ [error]表达式中的类型错误

灵感来源是this blogAlso tried the provided version as mergeStrategy might have been replaced by assemblyMergeStrategy

1 个答案:

答案 0 :(得分:3)

您是否在project / plugins.sbt文件中引用了程序集插件? assemblyMergeStrategy由插件定义。

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