Skip to content
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

Duplicated META-INF/MANIFEST.MF entries when using packageWithJVMJar := true on Windows #113

Closed
He-Pin opened this issue Jan 21, 2024 · 10 comments · Fixed by #115
Closed
Labels

Comments

@He-Pin
Copy link
Contributor

He-Pin commented Jan 21, 2024

sbt:pekko-bench-jmh> last actor / osgiBundle
[info] Validating all packages are set private or exported for OSGi explicitly...
[warn] bnd: Unused -privatepackage instructions , no such package(s) on the class path: [org.apache.pekko.osgi.impl]
[warn] bnd: Unused Import-Package instructions: [scala.compat.java8.*]
[error] java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF
[error]         at java.base/java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:233)
[error]         at java.base/java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:109)
[error]         at sbt.io.IO$.addFileEntry$1(IO.scala:717)
[error]         at sbt.io.IO$.$anonfun$writeZip$6(IO.scala:726)
[error]         at sbt.io.IO$.$anonfun$writeZip$6$adapted(IO.scala:726)
[error]         at scala.collection.immutable.Stream.foreach(Stream.scala:533)
[error]         at sbt.io.IO$.writeZip(IO.scala:726)
[error]         at sbt.io.IO$.$anonfun$archive$2(IO.scala:676)
[error]         at sbt.io.IO$.$anonfun$archive$2$adapted(IO.scala:673)
[error]         at sbt.io.IO$.$anonfun$withZipOutput$1(IO.scala:773)
[error]         at sbt.io.IO$.$anonfun$withZipOutput$1$adapted(IO.scala:753)
[error]         at sbt.io.Using.apply(Using.scala:28)
[error]         at sbt.io.IO$.withZipOutput(IO.scala:753)
[error]         at sbt.io.IO$.archive(IO.scala:673)
[error]         at sbt.io.IO$.jar(IO.scala:621)
[error]         at com.typesafe.sbt.osgi.Osgi$.$anonfun$bundleTask$1(Osgi.scala:187)
[error]         at scala.Option.getOrElse(Option.scala:189)
[error]         at com.typesafe.sbt.osgi.Osgi$.withCache(Osgi.scala:112)
[error]         at com.typesafe.sbt.osgi.Osgi$.bundleTask(Osgi.scala:139)
[error]         at com.typesafe.sbt.osgi.SbtOsgi$.$anonfun$defaultOsgiSettings$1(SbtOsgi.scala:57)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error]         at sbt.Execute.work(Execute.scala:292)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]         at java.base/java.lang.Thread.run(Thread.java:829)
[error] (actor / osgiBundle) java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF
@mdedetrich
Copy link
Collaborator

mdedetrich commented Jan 22, 2024

I think this is windows related? Unfortunately I don't have a Windows machine on me but willing to accept any PR that solves the issue.

Also we do run against Windows in our CI so its interesting we are not getting problems there.

@Roiocam
Copy link

Roiocam commented Jan 22, 2024

Also we do run against Windows in our CI so its interesting we are not getting problems there.

Maybe the CI doesn't run any benchmarks?

@mdedetrich
Copy link
Collaborator

mdedetrich commented Jan 22, 2024

Maybe the CI doesn't run any benchmarks?

Well benchmarks aren't really relevant here. There may be an interesting interaction between sbt-jmh and sbt-osgi in which case the best way to replicated this would be write a scripted test that adds sbt-jmh as a plugin to try and reproduce it.

The best way to diagnose this would be to minimize the issue as a sbt-scripted test within this project.

An interesting thing to note specifically wrt Pekko, sbt-osgi has been updated some weeks ago where sbt-jmh was updated recently so maybe thats the root cause? Would be good to bisect which at which exact Pekko commit the issues are being caused.

@He-Pin
Copy link
Contributor Author

He-Pin commented Jan 22, 2024

seems it's ok on mac, but fails on Windows 11.

@mdedetrich
Copy link
Collaborator

seems it's ok on mac, but fails on Windows 11.

Also fine on Linux otherwise CI would be breaking. Try the find the commit which causes the breakage.

@mdedetrich
Copy link
Collaborator

See apache/pekko#986 (comment) for likely cause

@mdedetrich
Copy link
Collaborator

@He-Pin Also what JDK are you using, is it 8, 11, 17 or 21?

@mdedetrich mdedetrich added the bug label Jan 22, 2024
@mdedetrich mdedetrich changed the title Add mergeStrategy support Duplicated META-INF/MANIFEST.MF entries when using packageWithJVMJar := true on Windows Jan 22, 2024
@He-Pin
Copy link
Contributor Author

He-Pin commented Jan 22, 2024

@mdedetrich tested both java 8 and java 11, both fails.

@mdedetrich
Copy link
Collaborator

@mdedetrich tested both java 8 and java 11, both fails.

Thanks, created a PR at #115 to create a basic test with packageWithJVMJar := true to see if I can replicate it on Windows CI.

@mdedetrich
Copy link
Collaborator

@He-Pin So good news, I managed to replicate this with a trivial test in the Windows CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants