ant-user mailing list archives

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

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 org.apache.tools.ant.listener.MailLogger


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
maillogger.properties file and the "MailLogger.properties.file" 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 );
	 
project.init();

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,
Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message