Recover from a failed build

Is there no way to recover from a failed task? I would like to catch any failures in a task, recover by continuing on to the next task and dealing with it there. The task I’m looking at in particular is “build” and its dependencies.

I’ve tried looking at TaskState but that happens after the fact. Finalizer tasks only cleans up the task, and does not do much else. Prefer not to have to use the --continue argument.

You’ll have to explain what you’re trying to achieve in more detail.

I want to grab the compile output, and if the build failed, put that into a html report.

The idea here is that I still get meaningful output from the task, and I can still work with it without it “failing”.

So how would a finalizer task on the compile task not do what you need?

The finalized task is still flagged as failed.

So you don’t want the build to fail if compilation fails?

Yup! Exactly.

I’ve personally also tried it with GradleBuild, but the GradleBuild task itself fails if any of the tasks it runs fails too (even with the --continue StartParameter).

As per our irc discussion, I’d like for this to be considered as a feature request / enhancement to TaskState =). This could theroetically be implemented by TaskState allowing us to manipulate the final TaskState when the task completes (either through the TaskExecutionListener, or Finalizer). A Finalizer task could allow for recovery from a task failure (like a try catch), without needing to make modifications to the task in question.

Thanks!

Hi Darryl,

I’m not keen on this idea. It raises a lot of questions about how dependent tasks would deal with the fact that they can’t rely on their dependency successfully getting what they need in to the right state. That is, it’s somewhat against the dependency based model.

Also, we’d need one ore more compelling use cases in order to consider it.