Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing unnessary classes from third party libraries and JARs [duplicate]

I need to remove unused classes from third party JARs. Why tools should I use?

I already tried to use ProGuard. However, it removes only unused classes from the project itself but the library jars - third party - always remain unchanged.

like image 779
M.ES Avatar asked Sep 12 '11 08:09

M.ES


People also ask

How do you remove unused jars?

Remove -> Test -> Remove -> Test -> Remove -> Hope you enjoy :) Change project to maven and select only jar you wanna use. For me this is the easiest way.


1 Answers

You can create an uber jar and then use ProGuard. Repackaging library classes into jars would be a challenge, but from the spirit of your question you will prefer the uber jar as such.

As other posters have commented, you still need to be careful about classes loaded through the so much abused and misunderstood reflection mechanism.

like image 86
Mario Rossi Avatar answered Oct 21 '22 01:10

Mario Rossi