删除未使用的项目罐子 [英] remove unused jars from project

查看:126
本文介绍了删除未使用的项目罐子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

结果
什么是最简单的方法(工具?)从我的Java(蚂蚁)的项目删除未使用的罐子。我们的项目已经变得非常巨大,我们希望做一个清理。但是也有一些加入到classpath几罐,但不是全部用于编译/运行。有没有办法通过从命令行运行一些实用的识别不必要的罐子?结果
注意:我们不想跟着删除一个或多个罐子的繁琐过程,然后编译/运行,如果这些要求或不测试


What is the easiest way (tool ?) to remove unused jars from my java (ant ) project. Our project has become really huge, and we want to do a clean up. There are several jars that are added to the classpath, but not all are used for compile/run. Is there a way to identify the unnecessary jars by running some utility from command line?
Note: we do not want to follow the tedious process of removing one or more jars, then compile/run to test if those are required or not.

推荐答案

这是我做的最后结果
我用JBOSS TattleTale( http://www.jboss.org/tattletale )在编译时识别未使用的罐子(据报道17罐子为未使用)。结果然后对于每个在该列表中的罐子,我做我的项目字符串搜索找到,如果在任何地方使用的jar的最高级别包(这是一个尝试,看看是否属于这个罐子任何类装载使用反射)。结果这样,我是能够成功地消除我的项目6个罐子。结果
因为,在编译时未使用的罐子的数量较少,这种做法是快。

This is what I did finally
I used JBOSS TattleTale (http://www.jboss.org/tattletale) to identify unused jars at compile time (It reported 17 jars as unused).
Then for each of the jar in that list, I did a string search on my project to find if the highest package level of the jar was used anywhere (this is an attempt to see if any class belonging to this jar was loaded using reflection).
This way I was able to successfully eliminate 6 jars from my project.
Since, number of unused jars at compile time was small, this approach was quick.

这篇关于删除未使用的项目罐子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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