Build deduplicate fails
polyzos opened this issue · 3 comments
Hi, so im trying to package with sbt-assembly and i run at the following error
[error] (kafkaConsumer / assembly) deduplicate: different file contents found in the following:
[error] /home/ipolyzos/.ivy2/cache/io.netty/netty-handler/jars/netty-handler-4.0.56.Final.jar:META-INF/io.netty.versions.properties
[error] /home/ipolyzos/.ivy2/cache/io.netty/netty-transport/jars/netty-transport-4.0.56.Final.jar:META-INF/io.netty.versions.properties
[error] /home/ipolyzos/.ivy2/cache/io.netty/netty-codec/jars/netty-codec-4.0.56.Final.jar:META-INF/io.netty.versions.properties
[error] Total time: 3 s, completed Mar 10, 2019 12:29:41 PM
These are my dependencies
lazy val dependencies =
new {
val thriftV = "0.12.0"
val logbackV = "1.2.3"
val scalaLoggingV = "3.9.2"
val kafkaV = "1.1.0"
val typesafeconfigV = "1.3.2"
val phantomV = "2.37.0"
val akkaV = "2.5.21"
val thrift = "org.apache.thrift" % "libthrift" % thriftV
val logback = "ch.qos.logback" % "logback-classic" % logbackV
val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingV
val kafka = "org.apache.kafka" %% "kafka" % kafkaV
val typesafeConfig = "com.typesafe" % "config" % typesafeconfigV
val phantom = "com.outworkers" %% "phantom-dsl" % phantomV //exclude("io.netty","netty-buffer")
val akka = "com.typesafe.akka" %% "akka-actor" % akkaV
}
and added this
assemblyMergeStrategy in assembly := {
case x if x.endsWith("io.netty.versions.properties") => MergeStrategy.first
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
But nothing seems to work.
It seems to be an issue with multiproject build.. if i remove the project that uses the dependency and make it a standalone project addind the mergestrategy builds the jar correctly. I don't know though why it fails in multi-builds.
assemblyMergeStrategy in assembly <<= (assemblyMergeStrategy in assembly) { (old) =>
case PathList("META-INF", "io.netty.versions.properties") => MergeStrategy.last
case x => old(x)
}
@alexflav23 This won't work either
First of all the <<= operator is removed and when i use the new syntax i get the same error.
For some reason this happens only in multi-project builds
I think you can replicate if you create a mulproject sbt.
module-1
module-2
module-3
add the phantom dependency lets say only on the first one. If you try sbt-assembly it will fail with the deduplicate error, but then u create module-1 as a standalone project it won't.
(Adding the merging strategy in both versions of course)