Can I identify libraries that are not being used with IDEA's dependency analysis

I have an 'old fashioned' style project with a lib directory containing a load of jars (no maven or ivy here).

I think that some of the jars can be deleted, but would like to check. I know that none of our code relies on them, but I'm not sure what the dependencies are between the libraries.

Can I use IDEA's dependency analysis tools to check if the any of the classes in the suspect jars are used in any other jars? I've tried several different ways that I think should tell me, but I think that I'm missing something because it doesn't give me the answers I'm expecting.

If anyone has any suggestions I'd be grateful.

Many thanks,

Comment actions Permalink

Hi Patrick,

There's actually an inspection for this, "Unused Library". According to the description it'll only tell you which libraries are not used directly from the code, not which are required indirectly from other libs.

Another thing you might look at is ProGuard. It's used normally for optimising, obfuscating and shrinking J2ME apps, but as part of that function it'll trace through all code paths and tell you which code is actually called from your defined entry points. You might be able to use that to determine it.


Comment actions Permalink

Thanks. I guess that the answer to the question is 'no' and the only way to really solve the problem is to remove jars and see if stuff still works ...


Please sign in to leave a comment.