i would launch n number of ant targets from bash e.g
#!/bin/bash

tname=ant_target_$1 > log
echo "ANT: Running $tname task..."
ant $tname
antReturnCode=$?
echo "ANT: Return code is: \""$antReturnCode"\""
if [ $antReturnCode -ne 0 ];then
    echo "BUILD ERROR: I am failing hard..."
else
    echo "SUCCESS"
fi

tname=ant_target_$2 >log
echo "ANT: Running $tname task..."
ant $tname
antReturnCode=$?
echo "ANT: Return code is: \""$antReturnCode"\""
 
if [ $antReturnCode -ne 0 ];then
    echo "BUILD ERROR: I am failing hard..."
else
    echo "SUCCESS"
fi

echo "send along the LOG file to the mail task"
ant mail log

Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.


> Date: Fri, 5 Aug 2011 15:06:57 -0400
> Subject: Re: Mail task on Target failure
> From: lgd...@cyrusinnovation.com
> To: user@ant.apache.org
> 
> I know TeamCity does keep the logs, or can be configured to do so.  It does
> for us.
> 
> Laura
> 
> On Fri, Aug 5, 2011 at 1:16 PM, glenn opdycke-hansen 
> <glenn...@gmail.com>wrote:
> 
> > +1 CI Servers.
> > It can be used to call an Ant script and email if there is success or
> > failure.  We notice that for some CI servers the log was not kept,
> > which is important for error situations.  But they are easy to set up,
> > so it worth investigating.
> >
> > --glenn
> >
> >
> >
> > On Fri, Aug 5, 2011 at 09:32, Laura Dean <lgd...@cyrusinnovation.com>
> > wrote:
> > > To take a different approach: have you considered using a continuous
> > > integration server?  This is exactly the sort of thing they're good at,
> > and
> > > then your ant setup could just worry about building.
> > >
> > > I've used TeamCity and have heard good things about Jenkins (
> > > http://jenkins-ci.org/), but probably any of them could handle sending
> > > email, since that's one of the main features people want in such a
> > system.
> > >
> > > Laura
> > >
> > > On Fri, Aug 5, 2011 at 5:02 AM, vino_hymi <vinoh...@gmail.com> wrote:
> > >
> > >> Hi,
> > >>
> > >> I have ant project where there is set of targets. After successful
> > >> completion of all targets I call mail target at the end to send a mail
> > with
> > >> attached logs with message build successful.
> > >>
> > >> Now, my challenge is if one of the target fails then build exits so it
> > will
> > >> not proceed to mail target which is the last one to perform on
> > completion
> > >> of
> > >> all. How can I use mail target to send mail on any target failure?
> > >>
> > >> Any hints?
> > >>
> > >> -Vinodh Kumar
> > >>
> > >> --
> > >> View this message in context:
> > >>
> > http://ant.1045680.n5.nabble.com/Mail-task-on-Target-failure-tp4669046p4669046.html
> > >> Sent from the Ant - Users mailing list archive at Nabble.com.
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
> > >> For additional commands, e-mail: user-h...@ant.apache.org
> > >>
> > >>
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
> > For additional commands, e-mail: user-h...@ant.apache.org
> >
> >
                                          

Reply via email to