sbt-assembly:重命名具有合并冲突的类(阴影) [英] sbt-assembly: Rename Class with merge conflicts (shade)

查看:36
本文介绍了sbt-assembly:重命名具有合并冲突的类(阴影)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何告诉 sbt-assembly 保留其现有的合并/重复数据删除规则,除非当两个 .class 文件冲突时,重命名(并发出警告以便我知道)?

这是否与 Maven 中使用的阴影策略相同?

解决方案

rename 策略实际上只是重命名文件而不更改内容,因此它不适用于 .class文件.重命名的主要用例是许可证文件.

2015 年 9 月更新:

sbt-assembly 0.14.0 添加了阴影支持.

<块引用>

sbt-assembly 可以从您的项目或库依赖项中屏蔽类.在 Jar Jar Links 的支持下,字节码转换(通过 ASM)用于更改对重命名类的引用.

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

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?

解决方案

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
)

这篇关于sbt-assembly:重命名具有合并冲突的类(阴影)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆