sbt-assembly
sbt-assembly copied to clipboard
sbt-assembly appears not to shade all jars configured via .inLibrary
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!
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"
Thanks for the detective work.
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.
I think the jar has the suffix. It's the ModuleID
configured through "com.chuusai" %% "shapeless" % "version" needs substituteCross
, like the fixes for exclusion,
@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.
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