ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ara Abrahamian" <>
Subject xdoclet
Date Fri, 05 Apr 2002 11:59:23 GMT
Hi everybody,

OK, Ant is fun but at xdoclet team we're having trouble with it :-) I
think we're a very important customer of yours (a 2.5MB Ant plugin!), so
please help us ;-)

The problem is Ant's introspection mechanism. XDoclet has some very
interesting requirements, and Ant 1.x's introspection code stops us. We
need a more dynamic introspection mechanism. Basically what we're trying
to do is make xdoclet more modular. We don't want to define
createWeblogic() or createJboss() methods in EjbDocletTask. It's silly
to hard-code them there. We want to create an EjbDocletTask (true for
other tasks such as webdoclet too) which finds subtasks such as
WeblogicSubTask/etc at runtime, loads and instantiates it and lets Ant
configure it. You know Ant expects to see addWeblogic/createWeblogic/etc
kind of methods in the task. But we don't want to define these methods.
We want to look at something like a properties file (basically very
similar to antlib stuff) and load all subtasks dynamically at runtime.

But we can't because the introspection code is hardcoded and not
extensible. Erik came up with a good solution actually but Peter vetoed
it AFAIK. We came up with a hack for this problem: use BCEL to define
all those createBlabla methods. I need advice from Ant gurus for this
case. Is it feasible? What's your suggestion? Note that we need it now
not a year later.

One of our team members has done an Ant-less proof of concept test for
it. Here is a snippet from his email:

Here is how it works: A special class loader loads the original [task]
class. Before it returns the class, it instruments it with BCEL and adds
an arbitrary number of createBlaBla methods.

At the moment I have hardcoded what methods to create, but this can be
figured out by looking at the deployment descriptors (which I haven't
toyed with yet).

The issue is how do we tell Ant to use the instrumenting class loader? I
have taken a brief look at Ant's Taskdef and its Definer. I think we
need to subclass Taskdef and override the execute() method to use our
own class loader. It means that we'll need 2 taskdefs to use XDoclet
this way (until the Ant guys make it simpler for us).

<taskdef name="xtaskdef" classname="xdoclet.XTaskdef"/> <xtaskdef
name="ejbdoclet" classname="xdoclet.ejb.EjbDocletTask"/>

I haven't done this yet. Currently the proof of concept is a standalone
class, and is not run from Ant.

XTaskdef will do the business of looking at all the optional jars'
META-INF/xdoclet.xml to figure out what subtasks exist and instrument
the appropriate XDoclet Ant tasks using the instrumenting class loader.

Thanks in advance,

Do You Yahoo!?
Get your free address at

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message