sbt / sbt-assembly

Deploy über-JARs. Restart processes. (port of codahale/assembly-sbt)
MIT License
1.95k stars 224 forks source link

Shading is broken with SBT 1.2.8 #373

Closed alonsodomin closed 5 years ago

alonsodomin commented 5 years ago

Trying create an assembly JAR using SBT 1.2.8 and sbt-assembly 0.14.9 fails with an IllegalArgumentException when shading some of the dependencies:

[error] java.lang.IllegalArgumentException
[error]         at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:79)
[error]         at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:64)
[error]         at org.pantsbuild.jarjar.EmptyClassVisitor.<init>(EmptyClassVisitor.java:31)
[error]         at org.pantsbuild.jarjar.util.RemappingClassTransformer.<init>(RemappingClassTransformer.java:28)
[error]         at org.pantsbuild.jarjar.MainProcessor.<init>(MainProcessor.java:76)
[error]         at org.pantsbuild.jarjar.MainProcessor.<init>(MainProcessor.java:33)
[error]         at org.pantsbuild.jarjar.JJProcessor$.apply(JJProcessor.scala:29)
[error]         at sbtassembly.Shader$.shadeDirectory(Shader.scala:86)
[error]         at sbtassembly.Assembly$.$anonfun$assembleMappings$9(Assembly.scala:218)
[error]         at scala.collection.parallel.AugmentedIterableIterator.map2combiner(RemainsIterator.scala:112)
[error]         at scala.collection.parallel.AugmentedIterableIterator.map2combiner$(RemainsIterator.scala:109)
[error]         at scala.collection.parallel.immutable.ParVector$ParVectorIterator.map2combiner(ParVector.scala:62)
[error]         at scala.collection.parallel.ParIterableLike$Map.leaf(ParIterableLike.scala:1052)
[error]         at scala.collection.parallel.Task.$anonfun$tryLeaf$1(Tasks.scala:49)
[error]         at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error]         at scala.util.control.Breaks$$anon$1.catchBreak(Breaks.scala:63)
[error]         at scala.collection.parallel.Task.tryLeaf(Tasks.scala:52)

The reason seems to be related to the fact that there seems to be a mismatch between the version of ASM that SBT has (5.x) and the one that sbt-assembly uses (version 7.x via the jarjar lib).

Any idea how to fix this or workaround it?

alonsodomin commented 5 years ago

ignore this, it's not a problem in sbt-assembly or SBT, it must be due to a bad combination of plugins in my build, still trying to debug it yet to find which is the other one that is adding ASM 5.x to the classpath

mrksmb commented 3 years ago

I saw the same error message when running sbt assembly in combination with using shading rules and was able to resolve it by updating the jacoco sbt plugin to the latest version.