ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell" <flame...@gmail.com>
Subject Abusing the BuildListener
Date Thu, 13 Jul 2006 00:36:51 GMT
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.


Before I dig deep into how the xml is parsed and turned into an object
model - is it blatantly obvious what I'm doing wrong?

Hen

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


Mime
View raw message