How can I identify unnecessary banks included in my project?

I work in a Java project that uses the axis 2 library from Apache. The library with axis 2 consists of about 20 jar files, and some of them are not used. What I want to know if there is a way to determine which of these jar files are unused.

I use the Eclipse IDE, and I thought that one way to solve the problem is to add one jar at a time until I get error messages about the missing classes. However, I'm not sure if this will work, as some of the missing class errors only appear at runtime.

Does anyone know a better way to solve this problem?

+4
java jar
Jun 18 '09 at 12:11
source share
3 answers

tattletale FTW

http://www.jboss.org/tattletale

JBoss Tattletale is a tool to help you get an overview of the project you are working on or the product you depend on.

The tool will provide you with reports to help you.

  • Define dependencies between JAR files
  • Spot if the class is in multiple JAR files
  • Spot if the same JAR file is in multiple places.
  • With a list of what each JAR file requires and provides
+6
Jun 18 '09 at 12:13
source share

I would use your initial idea of ​​adding one jar at a time before compiling it.

You are correct that you can still find errors at runtime, but if the application is too large for good coverage with manual tests, I just run and test it to add the missing jars.

+1
Jun 18 '09 at 12:21
source share

I don't think you can reliably remove banks, since classes can be resolved at runtime, for example. using

Class.forName(className); 

You can define the class names used for the above, but this is unlikely.

Since classes will be requested / resolved at runtime, you can run your (complete) test suite to determine if everything works. But in the end, I would be very careful to remove the jars from a package such as Axis. I guess they are there for some reason. Is jar file size really a problem?

+1
Jun 18 '09 at 12:21
source share



All Articles