ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell" <flame...@gmail.com>
Subject Re: Abusing the BuildListener
Date Thu, 20 Jul 2006 00:33:35 GMT
On 7/12/06, Henri Yandell <flamefew@gmail.com> wrote:
> I suspect this isn't what was intended for the build listener, but
> I've been using it to override the build.xml for <junit> tasks. In
> startTask I ensure that haltonerror and haltonfailure are set to
> false. Next up I want to ensure there is always a <formatter
> type="xml"/>, but adding a new task in seems a lot more painful than
> simply modifying the existing objects.

Very happy; I've got it working. Many thanks for all the help!

I kept playing with the direction Matt had me go and it suddenly
worked (when I was really looking to see what the old error was). The
following code forces the haltonfailure and haltonerror attributes to
always be false; and ensures that an xml output is always done.

      public void taskStarted(BuildEvent event) {
            if(event.getTask().getTaskName().equals("junit")) {
                UnknownElement ue = (UnknownElement) event.getTask();
                RuntimeConfigurable rc = ue.getWrapper();
                rc.setAttribute("haltonfailure", "false");
                rc.setAttribute("haltonerror", "false");

                UnknownElement ue2 = new UnknownElement("formatter");
                ue.addChild(ue2);

                FormatterElement fe = new FormatterElement();
                RuntimeConfigurable rc2 = new RuntimeConfigurable(fe,
"formatter");
                rc2.setAttribute("type", "xml");
                rc.addChild(rc2);
            }
    }


Hopefully there won't be any surprises when I throw this into a real scenario.

Hen

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message