• <tfoot id='JkYx9'></tfoot>

    <small id='JkYx9'></small><noframes id='JkYx9'>

          <bdo id='JkYx9'></bdo><ul id='JkYx9'></ul>

      1. <legend id='JkYx9'><style id='JkYx9'><dir id='JkYx9'><q id='JkYx9'></q></dir></style></legend>
        <i id='JkYx9'><tr id='JkYx9'><dt id='JkYx9'><q id='JkYx9'><span id='JkYx9'><b id='JkYx9'><form id='JkYx9'><ins id='JkYx9'></ins><ul id='JkYx9'></ul><sub id='JkYx9'></sub></form><legend id='JkYx9'></legend><bdo id='JkYx9'><pre id='JkYx9'><center id='JkYx9'></center></pre></bdo></b><th id='JkYx9'></th></span></q></dt></tr></i><div id='JkYx9'><tfoot id='JkYx9'></tfoot><dl id='JkYx9'><fieldset id='JkYx9'></fieldset></dl></div>

        最小化 jar 依赖大小

        时间:2023-07-14

        <small id='ivhb1'></small><noframes id='ivhb1'>

          • <legend id='ivhb1'><style id='ivhb1'><dir id='ivhb1'><q id='ivhb1'></q></dir></style></legend>
              <tbody id='ivhb1'></tbody>
                <i id='ivhb1'><tr id='ivhb1'><dt id='ivhb1'><q id='ivhb1'><span id='ivhb1'><b id='ivhb1'><form id='ivhb1'><ins id='ivhb1'></ins><ul id='ivhb1'></ul><sub id='ivhb1'></sub></form><legend id='ivhb1'></legend><bdo id='ivhb1'><pre id='ivhb1'><center id='ivhb1'></center></pre></bdo></b><th id='ivhb1'></th></span></q></dt></tr></i><div id='ivhb1'><tfoot id='ivhb1'></tfoot><dl id='ivhb1'><fieldset id='ivhb1'></fieldset></dl></div>
                <tfoot id='ivhb1'></tfoot>
                • <bdo id='ivhb1'></bdo><ul id='ivhb1'></ul>

                  本文介绍了最小化 jar 依赖大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我编写的一个应用程序使用了几个第三方 jar.有时只使用了整个 50kB 到 1.7mB jar 中的一小部分——一个或两个函数调用或类.

                  an application I have written uses several third party jars. Sometimes only a small portion of the entire 50kB to 1.7mB jar is used - one or two function calls or classes.

                  减小罐子尺寸的最佳方法是什么.我应该下载源代码并用我需要的类构建一个 jar 吗?哪些现有工具可以帮助实现这一点(例如,我简要地查看了 http://code.google.com/p/jarjar/)?

                  What is the best way to reduce the jar sizes. Should I download the sources and build a jar with just the classes I need? What existing tools can help automate this (ex I briefly looked at http://code.google.com/p/jarjar/)?

                  谢谢

                  编辑 1:我想减小我的第三方官方"罐子的大小,如 swingx-1.6.jar (1.4 MB)、set-3.6 (1.7 MB) glazedlists-1.8.jar (820kB) 等,以便它们只包含我需要的最低限度的课程

                  Edit 1: I would like to lower the size of my third party 'official' jars like swingx-1.6.jar (1.4 MB), set-3.6 (1.7 MB) glazedlists-1.8.jar (820kB) , etc. so that they only contain the bare minimum classes I need

                  编辑 2:如果库使用反射,则手动或使用 proguard 之类的程序最小化 jar 会更加复杂.使用 google guice 注入不再起作用用proguard混淆后

                  Edit 2: Minimizing a jar by hand or by using a program like proguard is further complicated if the library uses reflection. Injection with google guice does not work anymore after obfuscation with proguard

                  cletus 在另一篇文章中的回答非常好 如何判断Java程序使用了哪些类?

                  The answer by cletus on another post is very good How to determine which classes are used by a Java program?

                  推荐答案

                  Proguard 将是一个选项.它可以消除未使用的类和方法.您还可以使用它来混淆,这可以进一步减小最终 jar 的大小.请注意,除非注意保持受影响的类不被混淆,否则按名称加载类可能会中断.

                  Proguard would be an option. It can eliminate unused classes and methods. You can also use it to obfuscate, which can further reduce the size of your final jar. Be aware that class loading by name is liable to break unless care is taken to keep the affected classes unobfuscated.

                  我发现 Proguard 非常有效 - 一开始可能有点难以理解.但是我没有任何类似的经验来提供比较.

                  I've found Proguard quite effective - can be a bit cryptic to understand at the outset. But I don't have any experience with similar to offer a comparison.

                  这篇关于最小化 jar 依赖大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:通过类名查找 pom 依赖项 下一篇:在 Gradle 中,如何生成具有解析为实际使用版本的动态依赖项的 POM 文件?

                  相关文章

                • <tfoot id='45A0l'></tfoot>
                • <legend id='45A0l'><style id='45A0l'><dir id='45A0l'><q id='45A0l'></q></dir></style></legend>
                  • <bdo id='45A0l'></bdo><ul id='45A0l'></ul>

                    <small id='45A0l'></small><noframes id='45A0l'>

                      <i id='45A0l'><tr id='45A0l'><dt id='45A0l'><q id='45A0l'><span id='45A0l'><b id='45A0l'><form id='45A0l'><ins id='45A0l'></ins><ul id='45A0l'></ul><sub id='45A0l'></sub></form><legend id='45A0l'></legend><bdo id='45A0l'><pre id='45A0l'><center id='45A0l'></center></pre></bdo></b><th id='45A0l'></th></span></q></dt></tr></i><div id='45A0l'><tfoot id='45A0l'></tfoot><dl id='45A0l'><fieldset id='45A0l'></fieldset></dl></div>