ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knuplesch, Juergen" <>
Subject AW: Custom element for jar task.
Date Thu, 11 Sep 2008 06:32:16 GMT

The error you get tells simply, that your created task is not an allowed subelement of the
You run into a syntax error.
It is not possible to change the jar task (or any other task) by adding your own tasks as

Probably you have to write your own jar-task, that will understand your subelement.

What i understood:
You created a task called autoservice. 

What does this task do? 
Does it produce a classpath??

What do you expect should the jar task do with the element?

Tell us and then you will get probably some hints to do what you want.

Then you have to write your own Ant-Task doing the stuff you want.

J├╝rgen Knuplesch                    

-----Urspr├╝ngliche Nachricht-----
Von: John5342 [] 
Gesendet: Mittwoch, 10. September 2008 20:08
Betreff: Custom element for jar task.


I have a rapidly evolving project which contains a large and varying number of service providers.
I was hoping to create to create a more specialized version of the service element that automatically
scans for providers in a give classpath but have run into some trouble asuming what i want
to do is even possible.

I started off by subclassing which provides the current
service element and added setClassPath() and some lgic to automatically scan the given classpath
for any classes implementing the the given type and add add appropriate providers to Service.
I then added the following to my build.xml:

<target name="autoservice.taskdef" depends="autoservice.compile">
    <typedef name="autoservice" classname=""

<target name="jar" depends="autoservice.taskdef,project.compile">
    <jar destfile="${build.dir}">
      <fileset dir="${src.dir}"/>
      <autoservice type="ag.core.AGApp" classpath="${build.dir}"/>

autoservice.taskdef runs fine but when i get to the jar target i get the following error:

/Projects/ag/build.xml:103: jar doesn't support the nested "autoservice"

Is what i am trying to do even possible? and if so any ideas where to go from here?

Thanks, John

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

View raw message