Here is a task that does some like that:
package task;
import org.apache.tools.ant.taskdefs.Sequential;
public class NoFail extends Sequential {
private String failureProperty;
public void setFailureProperty(String name) {
this.failureProperty = name;
}
public void execute() {
try {
super.execute();
} catch (Throwable t) {
if (failureProperty != null) {
getProject().setNewProperty(
failureProperty, "true");
}
}
}
}
Usage:
<project>
<mkdir dir="classes"/>
<javac srcdir="src" destdir="classes"/>
<taskdef name="nofail" classname="task.NoFail"
classpath="classes"/>
<target name="test">
<nofail failureproperty="failed">
<fail>This should fail</fail>
<echo>This will not be reached</echo>
</nofail>
<echo>failed is ${failed}</echo>
</target>
</project>
Peter
On Friday 03 October 2003 15:43, Emmanuel Feller wrote:
> I agree, it is a good option in my mind.
>
> +1 :)
>
> Emmanuel
> ----- Message d'origine -----
> De : "Jan Schroeder" <[EMAIL PROTECTED]>
> ï: <[EMAIL PROTECTED]>
> Envoyï: vendredi 3 octobre 2003 16:38
> Objet : failonerror; general solution
>
> > There are a few new entries in bugzilla regarding handling
>
> of
>
> > BuildExceptions.
>
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23540
>
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23581
>
> > Also, some tasks already implement some "failonerror"
>
> attribute (e.g.
>
> > <java>).
> >
> > What about creating a container task instead.
> > Like:
> >
> > <nofail failureproperty="part.failed">
> > <patch .../>
> > <echo ../>
> > <antcall />
> > </nofail>
> >
> > That way all tasks automatically have something like
>
> "failonerror" + you
>
> > actually know if the part failed and can take an
>
> appropriate build path
>
> > from here on.
> >
> >
> > Jan
> >
> >
> > ----------------------------------------------------------
>
> -----------
>
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]