Я использую sbt 1.2.8 и sbt-Assembly 0.14.9. Я пытаюсь создать толстый JAR для моего проекта, который использует Spark + Akka + gRPC. Сначала у меня было много ошибок дедупликации; Мне удалось решить все, кроме 1, и я не мог найти способ решить эту проблему часами.
Вот сообщение об ошибке, полученное от sbt assembly
:
[error] (assembly) deduplicate: different file contents found in the following:
[error] /Users/samedduzcay/.ivy2/cache/org.apache.arrow/arrow-vector/jars/arrow-vector-0.10.0.jar:git.properties
[error] /Users/samedduzcay/.ivy2/cache/org.apache.arrow/arrow-format/jars/arrow-format-0.10.0.jar:git.properties
[error] /Users/samedduzcay/.ivy2/cache/org.apache.arrow/arrow-memory/jars/arrow-memory-0.10.0.jar:git.properties
Вот мой build.sbt
:
import sbt.Keys._
import sbtassembly.AssemblyPlugin.autoImport.PathList
name := "xxx"
version := "1.0"
lazy val sv = "2.11.12"
scalaVersion := sv
lazy val akkaVersion = "2.5.19"
lazy val sparkVersion = "2.4.0"
enablePlugins(AkkaGrpcPlugin)
enablePlugins(JavaAgent)
javaAgents += "org.mortbay.jetty.alpn" % "jetty-alpn-agent" % "2.0.9" % "runtime;test"
test in assembly := {}
logLevel in assembly := Level.Debug
lazy val root = (project in file(".")).
settings(
inThisBuild(List(
organization := "com.smddzcy",
scalaVersion := sv
)),
name := "xxx",
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion,
"org.apache.spark" %% "spark-sql" % sparkVersion,
"org.mariadb.jdbc" % "mariadb-java-client" % "2.3.0",
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-protobuf" % akkaVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
// "com.google.guava" % "guava" % "27.0.1-jre" % Compile,
// "org.apache.httpcomponents" % "httpcore" % "4.4.10" % Compile,
"com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion % Test,
"org.scalatest" %% "scalatest" % "3.0.5" % Test
)
)
assemblyMergeStrategy in assembly := {
case PathList(pl@_*) if pl.contains("log4j.properties") => MergeStrategy.concat
case PathList("META-INF", "io.netty.versions.properties") => MergeStrategy.last
case PathList("org", "aopalliance", xs@_*) => MergeStrategy.first
case PathList("javax", "inject", xs@_*) => MergeStrategy.first
case PathList("javax", "servlet", xs@_*) => MergeStrategy.first
case PathList("javax", "activation", xs@_*) => MergeStrategy.first
case PathList("org", "commons-collections", x@_*) => MergeStrategy.first
case PathList("org", "apache", xs@_*) => MergeStrategy.first
case PathList("com", "google", xs@_*) => MergeStrategy.first
case "about.html" => MergeStrategy.rename
case "META-INF/ECLIPSEF.RSA" => MergeStrategy.first
case "META-INF/mailcap" => MergeStrategy.first
case "META-INF/mimetypes.default" => MergeStrategy.first
case "plugin.properties" => MergeStrategy.first
case "application.conf" => MergeStrategy.concat
case "reference.conf" => MergeStrategy.concat
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
Возможно, мне что-то не хватает в assemblyMergeStrategy
(или есть что-то дополнительное).