ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay Glanville" <>
Subject How to force ant to continue after build failure?
Date Mon, 20 Nov 2000 12:49:16 GMT
In my build file, I want to mail the results of the build to the loadbuild
manager regardless of success or fail.  Therefore, I naively made a
build.xml file that looks like this:

  <target name="compile" depends="init" >
    <recorder file="compile.output" recording="on" />
    <javac .../>
    <recorder file="compile.output" recording="off" />

  <target name="notify" >
    <mail files="compile.output" ... />

  <target name="formal_loadbuild"
      depends="compile,notify" >

(the <recorder> task is one that I created.  It simply adds a build listener
to the project, recording all events to the stated file.  If people like, I
will clean it up and submit it for possible future inclusion.)

The reason that I use the word naivety is because I forgot that if the javac
task fails, then the build process stops.  This means that my loadbuild
manager doesn't get notified of loadbuild failures.  Is there a "magic"
property that I can set to force ant to continue after build failures?  

Do I have other options?  I know that I could have two build files, one for
the <javac> task that actually does the work, and the other for the
formal_loadbuild target that uses an <ant> task to run the javac and then
mails the results.  Something like this:
--- inner_build.xml ---
  <target name="compile" depends="init" >
    <javac ... />
--- inner_build.xml ---
--- build.xml ---
  <target name="formal_loadbuild" >
    <ant antfile="inner_build.xml" 
      output="compile.output" />
    <mail files="compile.output" .../>
--- build.xml ---
The reason I don't like this is because I'm now having to maintain two
separate build files for one build process.  By extension, I now need to
completely isolate my compile task from all the tasks that depend on it.

Do I have other options then the one mentioned above?

Thanks for the replies I hope I get  =>


PS: I've searched the e-mail archives, but I've found no answer to my
question, only the same question asked by other people.

Jay Dickon Glanville
P068 - SiteManager Development, Nortel Networks
613-765-1144 (ESN 395-1144)
MS: 045/55/A05

View raw message