I have a couple of tools that use Ant to deal with the rebuilding process. Here is a good documentation, on how to set it up on OSX.
“Apache Ant is a software tool for automating software build processes. It is similar to make but is written in the Java language, requires the Java platform, and is best suited to building Java projects.”