You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Rhodes, Phillip C." <Ph...@alcoa.com> on 2004/01/15 23:43:21 UTC

email on build failure?

I have multiple targets.  Each target has a responsible project manager.  If the target fails, I want to send an email to this specific person.  using the ant -logger mechanism appears to make it global for the entire build.
Is there any way besides ant -logger org.apache.tools.ant.listener.MailLogger?
Thanks everyone!



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


Re: email on build failure?

Posted by Will Lopez <wi...@eds.com>.
...there is probably a more elegant solution (this was for Ant 1.5.x) 
but I did something similar...see <mail> task in the manual and 
ant-contrib task <trycatch> 
(http://ant-contrib.sourceforge.net/ant-contrib/manual/tasks/trycatch.html)....

<target name="buildX" >
         <trycatch> <!-- see doco for attributes -->
               <try>
                       <!-- do build stuff -->
                </try>
                <catch>
                    <mail mailhost="${mail-host}"
                             from="${from}"
                             tolist="${to}"
                             subject="${what ever you want}" />
               </catch>
          </trycatch>
          <!-- also offers finally task -->
</target>

Rhodes, Phillip C. wrote:

>I have multiple targets.  Each target has a responsible project manager.  If the target fails, I want to send an email to this specific person.  using the ant -logger mechanism appears to make it global for the entire build.
>Is there any way besides ant -logger org.apache.tools.ant.listener.MailLogger?
>Thanks everyone!
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>  
>


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


Re: email on build failure?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jan 15, 2004, at 5:43 PM, Rhodes, Phillip C. wrote:
> I have multiple targets.  Each target has a responsible project 
> manager.  If the target fails, I want to send an email to this 
> specific person.  using the ant -logger mechanism appears to make it 
> global for the entire build.
> Is there any way besides ant -logger 
> org.apache.tools.ant.listener.MailLogger?

MailLogger can do this.... just don't set the "to" (look at the docs 
for the specific name) address property until the appropriate time, at 
the top of the targets - you can set that property differently in each 
target.

However, if the build fails before that target is reached, MailLogger 
would complain.

	Erik


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