sbt-assembly icon indicating copy to clipboard operation
sbt-assembly copied to clipboard

sbt-assembly appears not to shade all jars configured via .inLibrary

Open easel opened this issue 8 years ago • 6 comments

I've put together a simple repro project at https://github.com/easel/shading-repro

The basic gist is that using .inAll properly shades shapeless.*, while attempting to use .inProject.inLibrary() doesn't. There's obviously a chance I'm doing it wrong, but at this point I'm flummoxed as to how because I've tried a lot of different combinations, orders, etc with no luck.

Any insight appreciated!

easel avatar Feb 09 '17 22:02 easel

Ok so I've tracked this down, even so far as a failing test. The root issue is that the library matching code doesn't include the _2.11 suffix from scala libraries. It does this because it tries to get the moduleId from the jar file, which apparently doesn't include the _2.11 suffix.

Regardless, there is a workaround: use "com.chuusai" % "shapeless_2.11" instead of "com.chuusai" %% "shapeless"

easel avatar Mar 22 '17 01:03 easel

Thanks for the detective work.

eed3si9n avatar Mar 22 '17 01:03 eed3si9n

If it's helpful I can push the change to the shading test to make it fail. I tried to track down the best place to adjust the module id lookup and comparison but ended up going down a bunch of blind alleys and gave up on it in favor of the workaround =p

I'm in a pretty good position to actually make a fix and push it if you can give me some pointers as to where.

easel avatar Mar 22 '17 16:03 easel

I think the jar has the suffix. It's the ModuleID configured through "com.chuusai" %% "shapeless" % "version" needs substituteCross, like the fixes for exclusion,

manuzhang avatar Jul 26 '17 01:07 manuzhang

@easel - I saw your post after asking https://stackoverflow.com/questions/49675666/why-wont-sbt-assembly-shade-json4s-using-inlibrary. It's interesting that it works for you using % and the suffix _2.11. I can't even get that to work.

DonBranson avatar Apr 06 '18 19:04 DonBranson

I needed this a lot. I can't get it to work even with the _2.11 suffix to shade aws-java-sdk-core on elastic4s-aws, so I need to shade with .inAll

renecouto avatar Sep 18 '19 20:09 renecouto