java - 需要了解一些 `ant fat/shaded` jar 概念
问题描述
我正在尝试创建一个包含其他罐子的runtime dependencies
罐子。
我使用了以下脚本
<jar destfile="MyApplication.jar">
<zipgroupfileset dir="lib" includes="*.jar" />
<!-- other options -->
<manifest>
<attribute name="Main-Class" value="Main.MainClass" />
</manifest>
</jar>
当我说其他runtime dependencies
罐子时,我在想那些会作为一个完整的罐子添加到里面MyApplication.jar
像下面的东西。
MyApplication.jar
--`lib/depedent1.jar`
--`lib/depedent2.jar`
-- my.class
-- myAnother.class
但是,我发现MyApplication.jar
实际上已经提取了lib/depedent1.jar
/lib/depedent2.jar
如果内容被提取,我没有任何问题,但只是好奇不可能创建一个里面有真正区分的依赖罐子的罐子吗?
解决方案
基本上,Shaded/fat jar 在它的父 jar 中提取依赖项的内容
MyApplication.jar
-- com.lib1.corp.SomeClass.class
-- com.lib2.corp.AnotherClass.class
-- com.my.corp.myFirst.class
-- com.my.corp.myAnother.class
推荐阅读
- sql - 在 SQL Server 中评估“value1 IS NOT DISTINCT FROM value2”的最佳方法
- c++ - 为什么使用 SFINAE 而不是函数重载?
- java - rror-creating-bean-with-name-springsecurityfilterchain
- jboss - Quarkus:自定义 JSON 日志记录格式
- lambda - 了解 Redex 中的 lambda 替换
- php - 联系表格 7 和 PayPal IPN 集成
- ethereum - 如何让用户在没有钱包的情况下使用以太坊 DApp
- typescript - Typescript 泛型函数不会抱怨回调返回类型
- sql-server - 无法从 Visual Studio 中的 sql server objects explorer 打开任何数据库:它说登录失败
- python - 一个 obj 的 Python 模拟函数