Should sbt-assembly do "class transfer using maven-shade-plug-in"?

Description sbt-assembly a merge strategy called a rename similar to it may allow something like the maven-shade-plugin shader operation, which will move classes and their references to allow incompatible library versions to be managed.

Would it be appropriate for sbt-assembly to execute this function?

I used the following merge strategy to try using renaming as a move mechanism, but while it matches all files, it passes them directly (which is consistent with viewing the code).

assemblyMergeStrategy in assembly := { s => s match { case PathList("com", "clearspring", "analytics", _*) => { println("match_cs: " + s) MergeStrategy.rename } case x => { println("x: " + x) val oldStrategy = (assemblyMergeStrategy in assembly).value oldStrategy(x) } } } 
+5
source share
1 answer

Updated in September 2015 :

sbt-assembly 0.14.0 adds shading support.

sbt-assembly can obscure classes from your projects or from library dependencies. With the support of Jar Jar Links, bytecode conversion (via ASM) is used to change references to renamed classes.

 assemblyShadeRules in assembly := Seq( ShadeRule.rename("org.apache.commons.io.**" -> " shadeio.@1 ").inAll ) 
+5
source

Source: https://habr.com/ru/post/1214631/


All Articles