You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Da...@lawson.com on 2000/12/20 19:39:39 UTC

Multiple builds and failures



Howdy.

I'm building my way down a directory tree using build.xml files in every
subdirectory and a chain of <ant /> tasks in each build.xml.  I believe
I have to do it this way because certain subdirectories need special handling,
and I only want to make changes (when they are necessary) in a single build.xml
file.

My problem is this.  I want ant to try to build everything every time, even when
one of the <ant /> tasks in a subdirectory fails.  Sometimes an error in a
single subdirectory will be fatal to everything in the build, and sometimes not.
I want ant to make a strong effort to build everything every time, regardless of
errors.

It appears, however, that a single error in one subdirectory halts the entire
build.  I'm assuming that this is due to the fact that ant slurps up all the
data in all the build.xml files and tries to execute everything in one fell
swoop with a single JVM.  So the question is, short of using <java /> with the
'fork' attribute to perform each separate build, is there any way to get ant to
continue building regardless of errors it may encounter?

Thanks,

--dave



Re: Multiple builds and failures

Posted by James Duncan Davidson <du...@x180.net>.
On 12/20/00 1:46 PM, "Conor MacNeill" <co...@cognet.com.au> wrote:

> Ant's general philosohpy to date has been to fail quickly. If there is some
> problem, Ant does not try to limp along. You fix it and build again. If you
> want that changed, it would be best to get involved in the Ant-Dev
> discussions about Ant's future direction.
 
Right. Fail fast is a feature here. Tasks that expect to not succeed
completely, but don't want to stop the build should not return a false "stop
the build" message. They should complain to the output, then let the build
proceed. What this means really depends on the task at hand -- different
criteria are used for each task so it's impossible for the core engine to
make such a judgment call.

-- 
James Duncan Davidson                                        duncan@x180.net
                                                                  !try; do()


Re: Multiple builds and failures

Posted by Conor MacNeill <co...@cognet.com.au>.
David,

Ant's general philosohpy to date has been to fail quickly. If there is some
problem, Ant does not try to limp along. You fix it and build again. If you
want that changed, it would be best to get involved in the Ant-Dev
discussions about Ant's future direction.

> From: <Da...@lawson.com>
> To: <an...@jakarta.apache.org>
>
> It appears, however, that a single error in one subdirectory halts the
entire
> build.  I'm assuming that this is due to the fact that ant slurps up all
the
> data in all the build.xml files and tries to execute everything in one
fell
> swoop with a single JVM.  So the question is, short of using <java />
with the
> 'fork' attribute to perform each separate build, is there any way to get
ant to
> continue building regardless of errors it may encounter?

Your assumption is not quite right. the builds are run relatively
independently, but within the same VM. Ant, however, takes into account the
results from a sub-build and propagates any build exceptions to the parent
build, halting it too.

Conor



Re: Multiple builds and failures

Posted by Bill Burton <bi...@progress.com>.
Hi Dave,

Ant doesn't have anything like make -k letting you continue despite
errors.

If you are really stuck and willing to hack the code a bit, the class
taskdefs/Ant.java which implements <antcall /> could be modified to take a
new attribute failonerror (like the exec task) where the default is true. 
When you don't want a failure in a called build.xml to stop the whole
build, you would set failonerror="false" like this:
    <antcall ... failonerror="false"/>
To implement this, add a new method setFailOnError to Ant.java (see
ExecTask.java) with a default true value.  Then modify the execute method
to catch BuildException.  If failonerror is true, rethrow the exception
else do nothing except possibly output a warning message.  This change
would prevent a BuildException generated in the called build.xml from
getting propagated up to the caller build.xml thus stopping your whole
build.

I suppose a similar change could be made to CallTarget.java so <ant ...
failonerror="false"/> would trap any BuildExceptions in the called target.

-Bill Burton

David.Bailey@lawson.com wrote:
> 
> Howdy.
> 
> I'm building my way down a directory tree using build.xml files in every
> subdirectory and a chain of <ant /> tasks in each build.xml.  I believe
> I have to do it this way because certain subdirectories need special handling,
> and I only want to make changes (when they are necessary) in a single build.xml
> file.
> 
> My problem is this.  I want ant to try to build everything every time, even when
> one of the <ant /> tasks in a subdirectory fails.  Sometimes an error in a
> single subdirectory will be fatal to everything in the build, and sometimes not.
> I want ant to make a strong effort to build everything every time, regardless of
> errors.
> 
> It appears, however, that a single error in one subdirectory halts the entire
> build.  I'm assuming that this is due to the fact that ant slurps up all the
> data in all the build.xml files and tries to execute everything in one fell
> swoop with a single JVM.  So the question is, short of using <java /> with the
> 'fork' attribute to perform each separate build, is there any way to get ant to
> continue building regardless of errors it may encounter?
> 
> Thanks,
> 
> --dave