Hello,
 
I have created an include file called mail.include that contains the following task structure:
 
<?xml version="1.0" encoding="utf-8" ?>
<project name="MailProperties">
 <xmlpeek file=".\config.xml" xpath="/configuration/mail/[EMAIL PROTECTED]'mailserver']/@value"
  property="mailserver" verbose="true" />
 <xmlpeek file=".\config.xml" xpath="/configuration/mail/[EMAIL PROTECTED]'mailto']/@value"
  property="mailto" verbose="true" />
 <xmlpeek file=".\config.xml" xpath="/configuration/mail/[EMAIL PROTECTED]'mailfrom']/@value"
  property="mailfrom" verbose="true" />
 <xmlpeek file=".\config.xml" xpath="/configuration/mail/[EMAIL PROTECTED]'mailfailure']/@value"
  property="mailfailure" verbose="true" />
 <xmlpeek file=".\config.xml" xpath="/configuration/mail/[EMAIL PROTECTED]'mailsuccess']/@value"
  property="mailsuccess" verbose="true" />
 <xmlpeek file=".\config.xml" xpath="/configuration/mail/[EMAIL PROTECTED]'mailfailuresubject']/@value"
  property="mailfailuresubject" verbose="true" />
 <xmlpeek file=".\config.xml" xpath="/configuration/mail/[EMAIL PROTECTED]'mailsuccesssubject']/@value"
  property="mailsuccesssubject" verbose="true" />
 <echo message="${mailserver}"/>
 <echo message="${mailfrom}"/>
 <echo message="${mailto}"/>
 <property name="MailLogger.mailhost" value="${mailserver}" overwrite="false" dynamic="true" />
 <property name="MailLogger.from" value="${mailfrom}" dynamic="true"/>
 <property name="MailLogger.failure.notify" value="${mailfailure}" overwrite="false" dynamic="true"/>
 <property name="MailLogger.success.notify" value="${mailsuccess}" overwrite="false" dynamic="true"/>
 <property name="MailLogger.failure.to" value="${mailto}" dynamic="true"/>
 <property name=" MailLogger.success.to" value="${mailto}" dynamic="true"/>
 <property name="MailLogger.failure.subject" value="${mailfailuresubject}" overwrite="false" dynamic="true"/>
 <property name="MailLogger.success.subject" value="${mailsuccesssubject}" overwrite="false" dynamic="true"/>
</project>
 
This basically reads some values from the config.xml and like mailserver and mailfrom etc. and sets the MailLogger properties accordingly. But when I include this file in the main build file, I get an error of the following type:

MailLogger failed to send e-mail!
System.ArgumentNullException: Value cannot be null.
Parameter name: Missing required parameter MailLogger.from.
   at NAnt.Core.MailLogger.GetPropertyValue(PropertyDictionary properties, Strin
g name, String defaultValue)
   at NAnt.Core.MailLogger.BuildFinished(Object sender, BuildEventArgs e)
 
But I can see that MailLogger.from is getting the right property value when I run the include file separately. Any pointers on this?
 
Regards,
Niranjan
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to