Where do you put assemblyMergeStrategy in build.sbt?

给你一囗甜甜゛ 提交于 2019-12-11 20:39:06

问题


I have a MergeStrategy problem. How do I resolve it? Why are all those squiggly lines there?

The error message is Type mismatch, expected: String => MergeStrategy, actual: String => Any

I am new to scala, so, I have no idea what that syntax means. I have tried copying different merge strategies from all over stackoverflow and none and them work.

I have scala version 2.12.7 and sbt version 1.2.6.

My build.sbt looks like this:

lazy val root = (project in file(".")).
  settings(
    name := "bigdata-mx-2",
    version := "0.1",
    scalaVersion := "2.12.7",
    mainClass in Compile := Some("Main")
  )

libraryDependencies ++= Seq(
  "org.apache.hadoop" % "hadoop-core" % "1.2.1",
  "org.apache.parquet" % "parquet-hadoop" % "1.10.0",
  "junit" % "junit" % "4.12" % Test,
  "org.scalatest" %% "scalatest" % "3.2.0-SNAP10" % Test,
  "org.scalacheck" %% "scalacheck" % "1.14.0" % Test,
  "org.scala-lang" % "scala-library" % "2.12.7"
)

// Where do I put this thing:
assemblyMergeStrategy in assembly := {
  case PathList("META-INF", xs @ _*) => MergeStrategy.discard
  case x => MergeStrategy.first
}

Maybe I'm not putting it into the right place, where does it go?

来源:https://stackoverflow.com/questions/53068110/where-do-you-put-assemblymergestrategy-in-build-sbt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!