Shrink your Jars, its easier than you think!
James just referred me to the Ant <classfileset>. It examines dependencies between your .class files and removes any of the ones you don't actually need at runtime.Why is this useful?
Suppose you're building an app with some Jakarta libraries. Inevitably, you'll get the 2 classes you need, plus 98 you don't. Unfortunately, without <classfileset>, there's no reliable way to know which classes you can get rid of, since your 2 required classes could depend on 8 other classes.
Give me more reasons why this is useful.
With widespread adoption and understanding of the <classfileset> task, API developers like myself can be more generous in adding classes to the libraries. Without <classfileset>, each class I add to Glazed Lists increases the size of
glazedlists.jar
, regardless of whether anybody uses it. With the <classfileset> task, I can be somewhat more generous because the class doesn't necessarily place as much burden on disinterested users.So is glazedlists.jar going to jump from 300K to 1.2Gb?
Not anytime soon. As far as I am concerned, the most important weight of a library is the size of the publicly exported API. It sucks when I'm reading through the Javadocs for some new library and half the classes are implementation-details and support classes for the real APIs. It also sucks when the API author can't distill the API to be as compact and learnable as possible. Since <classfileset> doesn't do anything to simplify the learning curve of a larger API, I'm not going to let our API become bloated.