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

Adapt plugincache MergeStrategy to sbt-assembly:2.0.0 #16

Open
shaw-papadino opened this issue Nov 11, 2022 · 2 comments
Open

Adapt plugincache MergeStrategy to sbt-assembly:2.0.0 #16

shaw-papadino opened this issue Nov 11, 2022 · 2 comments

Comments

@shaw-papadino
Copy link

shaw-papadino commented Nov 11, 2022

Hello. Can I use adapted Log4j2MergeStrategy to sbt-assembly:2.0.0 ?

AsIs

When I change the version of sbt-assembly of the project including log4j2 plugins to 2.0.0 and run sbt assembly,
I get the following error.

[error] java.lang.IncompatibleClassChangeError: class sbtassembly.Log4j2MergeStrategy$$anon$1 has interface sbtassembly.MergeStrategy as super class
[error] 	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
[error] 	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
[error] 	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
[error] 	at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)
[error] 	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
[error] 	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
[error] 	at java.base/java.security.AccessController.doPrivileged(Native Method)
[error] 	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
[error] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
[error] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
[error] 	at sbtassembly.Log4j2MergeStrategy$.<init>(Log4j2MergeStrategy.scala:10)
[error] 	at sbtassembly.Log4j2MergeStrategy$.<clinit>(Log4j2MergeStrategy.scala)
[error] 	at $29c5b19eaf522355c3d4$.$anonfun$lambda$minusadd$minusmeasurement$4(build.sbt:137)
[error] 	at sbtassembly.Assembly$.$anonfun$assemble$31(Assembly.scala:311)
[error] 	at sbtassembly.Assembly$.$anonfun$assemble$31$adapted(Assembly.scala:311)
[error] 	at scala.collection.TraversableLike.$anonfun$partition$1(TraversableLike.scala:450)
[error] 	at scala.collection.Iterator.foreach(Iterator.scala:943)
[error] 	at scala.collection.Iterator.foreach$(Iterator.scala:943)
[error] 	at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
[error] 	at scala.collection.IterableLike.foreach(IterableLike.scala:74)
[error] 	at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
[error] 	at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
[error] 	at scala.collection.TraversableLike.partition(TraversableLike.scala:450)
[error] 	at scala.collection.TraversableLike.partition$(TraversableLike.scala:448)
[error] 	at scala.collection.AbstractTraversable.partition(Traversable.scala:108)
[error] 	at sbtassembly.Assembly$.$anonfun$assemble$30(Assembly.scala:311)
[error] 	at sbtassembly.Assembly$.timed$1(Assembly.scala:225)
[error] 	at sbtassembly.Assembly$.assemble(Assembly.scala:309)
[error] 	at sbtassembly.Assembly$.$anonfun$assemblyTask$1(Assembly.scala:193)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] 	at sbt.Execute.work(Execute.scala:291)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[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:834)
[error] (assembly) java.lang.IncompatibleClassChangeError: class sbtassembly.Log4j2MergeStrategy$$anon$1 has interface sbtassembly.MergeStrategy as super class
[error] Total time: 10 s, completed 2022/11/08 16:00:13

ToBe

Log4j2MergeStrategy supports sbt-assembly:2.0.0.

@conet
Copy link

conet commented Jul 20, 2023

It's unfortunate that this plugin seems to be unmaintained, I had to resort to this: sbt/sbt-assembly#501

@mpollmeier
Copy link

I had the same needs, so I forked, upgraded and released it.
For instructions see https://github.com/mpollmeier/sbt-assembly-log4j2

Special thanks to @fnqista for his PR.

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

No branches or pull requests

3 participants