检查包级别的 JAR 使用情况
有没有一种工具可以检查导入的 JAR 是否正在包内使用?基本上,我想从项目中删除任何未使用的 JAR,并且不想逐一删除每个 JAR 并检查每个删除的 JAR 是否存在可能的参考问题。
Is there a tool out there that can check if an imported JAR is being used from within a package? Basically I want to remove any unused JARs from a project and I do not want to have to remove each JAR one-by-one and check for possible reference issues for each removed JAR.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ProGuard 将为您解决问题!正确配置并给出一些初始规则,它将在输入目录中获取 jar 文件并将相同的 jar 输出到输出目录中。不需要的 Java 类文件不会包含在输出 jar 中,如果 jar 中没有剩余类,则将其简单地删除。该网站还包含大量示例。
除此之外,它还有许多出色的功能来帮助压缩和混淆您的最终项目。配置文件乍一看可能有点棘手——但它是有回报的。在一些正在进行的项目中,我们的最终存档大小减少了 1000% 以上。您是否经常包含一个库,但仅使用其中的一小部分功能?通过正确的设置,最终产品将只包含所需的内容。
ProGuard will do the trick for you! Configured correctly and given some initial rules it will take jar files in an input directory and output the same jars into the output directory. Java class files that aren't needed won't be included in the output jars and if a jar has no classes left, it's simply removed. The website also includes tons of examples.
In addition to doing this, it has a number of great features to help in compacting and obfuscating your final project. The configuration files may seem a bit tricky at first -- but it pays off. In some projects at work, we have final archive sizes that are reduced well over 1000%. How often have you included a library only to use a fraction of the functionality? With a proper setup the final product will only include what's needed.