sbt-assembly: Rename Class with merge conflicts (shade)

血红的双手。 提交于 2020-01-13 16:47:30

问题


How can I tell sbt-assembly to keep its existing merge / deduplicate rules, except, when two .class files conflice, rename (and issue a warning so I know about it)?

Would this be identical to the shade strategy used in Maven?


回答1:


The rename strategy literally just renames the file and it doesn't change the contents, so it won't work for .class files. The main use case for rename is for LICENSE files.

Updated in September 2015:

sbt-assembly 0.14.0 adds shading support.

sbt-assembly can shade classes from your projects or from the library dependencies. Backed by Jar Jar Links, bytecode transformation (via ASM) is used to change references to the renamed classes.

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


来源:https://stackoverflow.com/questions/24596914/sbt-assembly-rename-class-with-merge-conflicts-shade

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!