*/rsh tech|
your source for programming know-how
Generated by:
Craftsman

SafeMain: Calling Real Builds Without Exiting

If you want to actually test a build.xml file, you are going to have problems. There are a lot of issues involved with loading Ant correctly. Even if you get all the libraries and finally get the Ant.Main method to work, it will call System.exit() when it is finished--effectively killing your test.

SafeMain provides the ability to execute build.xml files, process normally, or catch errors--all without the System.exit() being called. It also includes a few helper methods for making the call a little easier.

See the SafeMainDocumentation API for more information. The methods you are interested in are the static start() methods.