I am trying to embed Ant into my application.
The following code gives me what I need.

executeAnt(String antfile, String target, PrintStream myOut, PrintStream myErr, int logLevel)
{
ProjectHelper helper = ProjectHelper.getProjectHelper();
Project project = new Project();
project.init();


logger.setMessageOutputLevel(logLevel);
logger.setOutputPrintStream(myOut);
logger.setErrorPrintStream(myErr);
DefaultLogger logger = new DefaultLogger();
// CommonsLoggingListener logger = new CommonsLoggingListener();
project.addBuildListener(logger);
helper.parse(project, new File(antfile));
project.executeTarget(target);
}


I am able to get it working with proper logging etc.
However, I have one annoyance that I cant get rid of.
When I run this code on Windows machine, a command-windows flashes
when project.executeTarget() gets called. I believe, this is because of some kind
of System.out / System.err binding that happens inside createLogger() of Main.java ...


I know most IDE(s) (Eclipse/JBuilder) have AntRunner which are modified version of
Ant-Main.java and they are able to suppress DOS-window.
I dont know how ?
Any directions will be appreciated.
Thanks,
-sharad




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



Reply via email to