ant-user mailing list archives

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


The error you get tells simply, that your created task is not an allowed subelement of the
jar-task. 
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
subelements.

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 [mailto:john5342@googlemail.com] 
Gesendet: Mittwoch, 10. September 2008 20:08
An: user@ant.apache.org
Betreff: Custom element for jar task.

Hi,

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 org.apache.tools.ant.types.spi.Service 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="ag.tools.ant.AutoService"
classpath="${autoservice.classes}"/>
</target>

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


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"
element.

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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message