ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris D" <>
Subject Using MailLogger programatically
Date Fri, 25 Jun 2004 14:51:01 GMT

I am having a problem getting MailLogger to work in a Java application.
So far if I execute from the command line the following, everything
works as expected:

ant -logger

However if I try to execute the same build.xml programatically in a Java
class using the following code segment, no email is sent.  I use a file and the "" setting
in the build.xml


File buildFile = new File( "./", "build.xml");

Project project = new Project();

ProjectHelper helper = new ProjectHelperImpl();

MailLogger logger = new MailLogger();
logger.setOutputPrintStream( System.out ); logger.setErrorPrintStream(
System.out ); logger.setMessageOutputLevel( Project.MSG_INFO );

project.setUserProperty( "ant.file", buildFile.getAbsolutePath() );
project.setUserProperty( "ant.version", Main.getAntVersion() );
project.setUserProperty( "job.currentTime", ( new Date() ).toString() );
project.addBuildListener( logger );

helper.parse( project, buildFile );

project.executeTarget( "main" ); 


Can someone let me know what I am missing between the two execution
methods.  Other then the email, the output is the same in both cases.

Thank you,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message