【问题标题】:Need to understand some `ant fat/shaded` jar concepts需要了解一些 `ant fat/shaded` jar 概念
【发布时间】:2020-08-29 18:53:20
【问题描述】:

我正在尝试创建一个包含其他 runtime dependencies jar 的 jar。

我使用了以下脚本

<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的所有内容

如果内容被提取,我没有任何问题,但只是好奇不可能创建一个内部有实际可区分的依赖 jar 的 jar?

【问题讨论】:

    标签: java build ant fatjar


    【解决方案1】:

    基本上,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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-08
      • 1970-01-01
      • 2020-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-13
      相关资源
      最近更新 更多