bertrand lancelot wrote:
Hi all,

I need to call ANT within my Java application.

first, I tried to execute the class "org.apache.tools.ant.Main" with
properties from my application. After ANT starts, the JVM breaks with
System.exit usage. As a result my application shutdown too!

You should not, in general, use Main to integrate Ant into another application. Main is the command line driver for Ant and expects to be in control of the VM. This is why it calls System.exit - to pass out the result code to the command line.


Main.java does other stuff too that you may not want in an embedded situation, such as, for example, redirecting System.Out, System.Err and System.In.

There is a comment at the top of Main.java:

 * If you integrating Ant into some other tool, this is not the class
 * to use as an entry point. Please see the source code of this
 * class to see how it manipulates the Ant project classes.

So, the best approach is to write your own driver to embed Ant into your application and consider how you are going to so IO redirection, etc.

What is probably true is that some facilities in Main need to be moved to a helper class to make them accessible to other "driving" programs. Work in this area would be useful.

Conor



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to