Search code examples
scalasbt-assembly

sbt assembly deduplicate: different file contents found in the following: jackson-annotations


having those deps:

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion,
  "com.typesafe.akka" %% "akka-stream" % akkaVersion,
  "com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
  "com.typesafe.akka" %% "akka-actor-typed" % akkaVersion,
  "com.typesafe.akka" %% "akka-stream" % akkaVersion,
  "com.lightbend.akka" %% "akka-stream-alpakka-json-streaming" % akkaJsonStreaming,
  "io.circe" %% "circe-generic-extras" % circeVersion,
  "de.heikoseeberger" %% "akka-http-circe" % akkaHttpCirce,
  "commons-codec" % "commons-codec" % commonsCodecVersion,
  "org.scalatest" %% "scalatest" % scalaTestVersion % "it, test",
)

when I run sbt assembly I get an error:

[error] (assembly) deduplicate: different file contents found in the following:
[error] /home/baku/.cache/coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.10.5/jackson-annotations-2.10.5.jar:module-info.class
[error] /home/baku/.cache/coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.10.5/jackson-core-2.10.5.jar:module-info.class
[error] /home/baku/.cache/coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.10.5/jackson-databind-2.10.5.jar:module-info.class

any idea how to fix this?


Solution

  • assemblyMergeStrategy in assembly := {
          case "module-info.class" => MergeStrategy.discard
          case x =>
            val oldStrategy = (assemblyMergeStrategy in assembly).value
            oldStrategy(x)
        }
    

    this helped