I have a series of eclipse projects that use a bunch of third party jars.
So many are included of different versions.
But I have noticed that some of these libraries, due to code changes over the time, are not used any more but the reference to the library is there.
Is there any plugin that shows the jar dependencies of each project and which I can remove safely?
Asked
Active
Viewed 926 times
3

Cratylus
- 52,998
- 69
- 209
- 339
-
1Don't you wish you were using Maven and getting to know of the dependency graph or adding/ removing dependency was a breeze? – Scorpion Sep 10 '11 at 07:38
-
1Sorry for the discussion here, but that is not true. Maven just ensures that the dependency is declared, it does not notice if the dependency is not used any more (or if a safe removal is possible). – mliebelt Sep 10 '11 at 08:58
-
2@mliebelt: http://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html - "Analyzes the dependencies of this project and determines which are: used and declared; used and undeclared; unused and declared." – millimoose Sep 10 '11 at 12:03
3 Answers
1
I am not aware of any plugin or tool that helps in doing what you want to do. However, there may be rules or procedures that help to reach the final end: a reduced set of libraries that is needed and consistent.
- I have found the the "Java API Compliance Checker" which allows to compare two versions of the same library. May help to reduce the number of the used libraries for the same purpose. I have not used it, so I cannot tell you about my experience.
- Define if it is allowed to have the same kind of library in different version available. Depending on the environment, this may or may not allowed.
Incremental process to reduce the amount of libraries needed:
- Remove one library each time from eclipse.
- Look if compile errors result from that.
- If yes resolve the compile errors.
- When all are resolved, start your unit tests (you have unit tests, of course :-)) and see if any unit test breaks.
Do these steps for each library you want to remove.
At the end it could be worthwhile to look at a tool like ivy that allows you to manage the libraries explicitly. Or even switch to Maven which allows you the same.
Final remark: The usage of a library should be
- decided by the architect of an application only and
- documented in the architecture handbook together with the reasons for doing that.

linuxbuild
- 15,843
- 6
- 60
- 87

mliebelt
- 15,345
- 7
- 55
- 92