ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From PDJul...@ThoughtWorks.COM
Subject Re: Calling Ant from a Java Class
Date Wed, 04 Apr 2001 03:36:20 GMT
Hello Boris:

We had to deal with this issue, i.e. the System.exit calls in the Ant Main
class, when developing CruiseControl. CC also wraps Ant with another java
class, like you want to do. Our solution was to install a security manager
which traps calls to System.exit. The source is openly avaiable from

Look at the net.sourceforge.cruisecontrol.NoExitSecurityManager and the
corresponding test class net.sourceforge.cruisecontrol.TestNoExitSecurity.
You can see the security manager being used for a call to the Ant Main
class in the net.sourceforge.cruisecontrol.MasterBuild class, approximately
line 247, note that this class is currently being refactored, so the line
number may be different. Search for "System.setSecurityManager(new

Hope that helps.

Best regards,
Paul Julius
ThoughtWorks, Inc.

-----Original Message-----
From:           Boris Debic []
Sent:           Tuesday, April 03, 2001 7:20 PM
To:        ''
Subject:        Calling Ant from a Java Class

Hi there,

What would be the right way to call ant tasks from Java, instead of doing
from shell or batch files.
I am thinking about adding a new class that would essentially be a copy of but without the system.exit()'s. I was hoping to set it up in
a way that we can catch build exceptions directly in a top level driver

Does anyone see any problems with this approach? Has anyone done something

Boris Debic.

View raw message