ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: Abusing the BuildListener
Date Thu, 13 Jul 2006 11:47:23 GMT
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?

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


Mime
View raw message