On 7/13/06, Steve Loughran <[EMAIL PROTECTED]> wrote:
Henri Yandell 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.
>
> Here's a chunk of my code:
>
> UnknownElement proxy = new UnknownElement("formatter");
> proxy.setNamespace("");
> proxy.setQName("formatter");
> proxy.setTaskName("formatter");
>
proxy.setTaskType("org.apache.tools.ant.taskdefs.optional.junit.FormatterElement");
>
> proxy.setProject(task.getProject());
> proxy.setOwningTarget(task.getOwningTarget());
> RuntimeConfigurable fc = new RuntimeConfigurable( proxy, "formatter");
> fc.setAttribute("type", "xml");
> rc.addChild(fc); // rc is the RuntimeConfig for the junit task
>
> When I build with a listener that contains this, I get:
>
> Class org.apache.tools.ant.UnknownElement doesn't support the "type"
> attribute.
have you not thought of using <presetdef> to define a new junit with the
right defaults?
Didn't know it existed :)
Reading the presetdef manual page, it sounds like it's not what I want
because it only sets defaults and not mandated values. I don't want to
allow the build.xml to change the settings.
My ant script calls other ant scripts, so would be worried that the
presetdef wouldn't survive down into the <ant> call. Of course I'm
assuming that I can get the listener into the <ant> call in some way
:)
Hen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]