You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ashley Williams <ag...@mac.com> on 2005/11/09 16:39:32 UTC
Creating an ant task from xml fragment
Hi,
I have a fragment of ant xml and would like to create a task or
target from it in my java code. For example here is the xml text:
<ejbdoclet ejbspec="2.1">
<fileset includes="**/*Bean.java"/>
<deploymentdescriptor/>
<remoteinterface/>
<homeinterface/>
<localinterface/>
<localhomeinterface/>
<jboss version="4.0"/> <!----- this is a
subtask, could prove tricky -->
</ejbdoclet>
And from the xdoclet website the ejb doclet class is:
xdoclet.modules.ejb.EjbDocletTask, which I believe will help form a
taskdef.
So from these two pieces of information, can I create the
corresponding task/target that I can run in my code?
Also can I run a task on its own or does it have to be in a target?
Any pseudo code inside the following method would be very helpful -
although the less pseudo the better ;)
Target createTarget(Node xml, Class taskdefClass) {
}
Thanks
- AW
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Creating an ant task from xml fragment
Posted by Steve Loughran <st...@apache.org>.
Ashley Williams wrote:
> Hi,
>
> I have a fragment of ant xml and would like to create a task or target
> from it in my java code. For example here is the xml text:
>
>
> <ejbdoclet ejbspec="2.1">
> <fileset includes="**/*Bean.java"/>
> <deploymentdescriptor/>
> <remoteinterface/>
> <homeinterface/>
> <localinterface/>
> <localhomeinterface/>
> <jboss version="4.0"/> <!----- this is a
> subtask, could prove tricky -->
> </ejbdoclet>
>
> And from the xdoclet website the ejb doclet class is:
> xdoclet.modules.ejb.EjbDocletTask, which I believe will help form a
> taskdef.
> So from these two pieces of information, can I create the corresponding
> task/target that I can run in my code?
>
> Also can I run a task on its own or does it have to be in a target?
>
>
> Any pseudo code inside the following method would be very helpful -
> although the less pseudo the better ;)
look at the embedding ant bit of the docs. you dont create XML; you
create the tasks as java classes
EjbDoclet doclet=new EjbDoclet();
doclet.setProject(myproject); //something like this?
doclet.setEjbSpec("2.1")
//maybe this
JBoss jboss=doclet.createJBoss();
//then run it.
doclet.execute();
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org