ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Reeves" <>
Subject RE: Emailing Build results
Date Tue, 04 Mar 2003 21:09:53 GMT
I use a slightly different approach to have the buld results sent.

First, I created a second, separate ant build script that wraps my
build.xml file.

This second script checks the project out of cvs, then executes the
build.xml present at the root of the project. When the ant call
completes, the log file is attached to a mail message. This occurs even
if the wrapped build fails.

I'm sure there's a cleaner way to do this, but it has run for months
with no problems.

Additionally, it's great to see the "Failed" or "Succeeded" on the
subject line, so I don't have to open each message and scour the logs
just to discover the build succeeded.




======== -->
        <!-- Target: build_project -->
======== -->

        <target name="build_project" depends="init, clean,

                <echo message="Executing ant file

                <exec   dir             = "${project.root.dir}"
                        executable      = "/usr/java/ant/bin/ant"
                        output          =
                        resultproperty  = ""
                        outputproperty  = "">
                        <arg line       = "${project.anttarget}"/>

                <echo message="Done."/>


======== -->
        <!-- Target: send_notification -->
======== -->

        <target name="send_notification" depends="init, build_project">

                <condition property="build.result" value="Failed!!!">
                        <equals arg1="1"

                <condition property="build.result" value="Succeeded!!!">
                        <equals arg1="0"

                <mail   tolist                  = "${to.address}"
                        from                    = "${from.address}"
                        subject                 = "${build.result}
${project.longname} Nightly Build - ${build.time}"
                        mailhost                = "${smtp.server}"
                        messagefile             =




> -----Original Message-----
> From: Alexei Betin [] 
> Sent: Tuesday, March 04, 2003 4:01 PM
> To: Ant Users List
> Subject: Emailing Build results
> what are reasonable options for emailing nightly Build results?
> MailLogger seems to have no way to attach the build log
> or use properties in Subject, 
> also I am already using NoBannerLogger - which leaves no 
> place for MailLogger...
> <mail> task cannot help me, because if I put it at the end
> of my build script, and the build fails, it'll never get to 
> execute it. 
> Is there a way to ensure a task is always called at the end? 
> maybe using different build files with <ant> or <antcall>? 
> <parallel> would not help me here because it can only wrap 
> tasks and not targets...
> Finally, I understand I can write my own Logger,
> but for a couple of reasons I don't want to - I would
> rather prefer to get the job done by some batch file,
> but I wonder if I am missing a nice pure-Ant solution
> Thanks,
> ~Alexei
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message