-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF #80
Comments
This is very strange. Are you putting any part of your settings in configuration? Also which version of sbt-assembly, sbt are you using? |
No, nothing in configuration and using sbt-assembly: 0.8.8 and sbt 0.12.0-RC4 |
I tried something like: mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case PathList("javax", "servlet", xs @ _*) => MergeStrategy.first
case x => old(x)
}
} and added
I can't work on this without being able to reproduce this in my environment. Could you try to create a mini project that can repro this using the latest sbt 0.12.3? |
Hi, I've also come across this problem and managed to reproduce it in a trivial project. I will upload it somewhere later (cant upload to github or elsewhere from here easily).
David |
@Chemmo Your output says:
I'm guessing there's customization problem here. |
What do you mean by customization problem? I uploaded a project reproducing the issue here David |
Here's from your import AssemblyKeys._
import sbtassembly.Plugin._
import sbt.Package.ManifestAttributes
assemblySettings
name := "mytest"
test in assembly := {}
packageOptions in assembly := Seq(ManifestAttributes(("Main-Class", "test"), ("Built-By","team"), ("Implementation-Title", "console"), ("Implementation-Version", "1.0")))
mergeStrategy in assembly := { case _ => MergeStrategy.first } You rewired |
I am running into the same issue. Maybe it is worth mentioning that in my case it is a multi-module sbt build? |
Thanks eed3si9n! I was getting the same error because I had overridden the entire default merge strategy to take the first. I didn't realize I was wiping out the lines that discard the manifests in defaultMergeStrategy. |
Random internet person here: this discussion solved my problem! Thank you! (For reference, I added |
GOD BLESS ALL OF YOU PEOPLE FOR THIS THREAD I WAS READY TO SMASH MY COMPUTER |
Bless +1, "case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard" did the trick. |
YES case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard trick. |
always fallback to the old merge strategy, as shown in the README code sample |
Thank you random internet person who suggested |
Thanks! Solved my problem as well. |
|
thanks people |
Thank you random internet person for suggesting |
i love this thread. 1+ from me as well since it worked |
Thank you guys |
If you fallback to the old strategy discarding should be there already: assemblyMergeStrategy in assembly := {
case PathList("javax", "servlet", xs @ _*) => MergeStrategy.first
// your other customization
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
} |
I have successfully been using sbt-assembly in my project for months now and recently it started complaining about duplicate entries for a couple classes after I added a couple of new dependencies. As a result I added the following to my build:
This gets me past these errors into the final building stages of my combined JAR but ultimately fails with the following:
As I understand it this shouldn't happen considering the default operation of dealing with MANIFEST.MF has worked successfully for me all along and my above additions should still be activating that. I've tried adding to my merge strategy:
But I still end up with the same error. In fact I've tried nearly every merge strategy and all fail except "discard". If I use "discard" though then the Main-Class is not set on my resulting combined JAR.
The text was updated successfully, but these errors were encountered: