The MILK Kodebase: Source Shake

Source Shake is a source-level tree-shaker for Java code. You give it a set of "library" source and a set of "your" source, and it tells you which files in the "library" are required by "your" files, or copies those files to the directory you specify. It finds files in the library directly required, as well as walking through the tree from those library files to the files they depend on, etc.

This was originally written to be used with the ANTLR library, since for some reason the ANTLR folks don't separate the tool from the libraries required by the tool's output.