ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Murdoch" <adammurdoch...@yahoo.com>
Subject RE: Custom Task with nested Patternset
Date Thu, 17 Jan 2002 23:44:59 GMT

Hi,

Have a read of "Developing with Ant" in the User Manual.  It describes the
basics of writing your own tasks.  Also read through the source for some of
the standard Ant tasks, to get an idea of the specifics of using a
patternset.


Adam

> -----Original Message-----
> From: Stefán Freyr Stefánsson [mailto:stefan@ru.is]
> Sent: Friday, 18 January 2002 2:10 AM
> To: ant-user@jakarta.apache.org
> Subject: Custom Task with nested Patternset
>
>
> Hello.
>
> I'm wondering if there is any information anywhere about how to program
> your own custom tasks.  I'm mostly interested in using a nested
> patternset element.
>
> The problem is that I need to extend a task written by someone else.
> The task is called <genjar> and it basically is a jar task where you
> specify the main class and the task extracts all the dependant classes
> and includes them in the generated jar.  In the <genjar> task you can
> specify a <resource> tag which lets you include additional resources
> that are not java class files (such as images, property files and so
> on).  The problem with the <resource> tag is that it doesn't allow me to
> specify a <patternset> which would take all the matching files from the
> classpath and include them also in the generated JAR file.  To clarify,
> let me give an example:
> <genjar jarfile="test.jar">
>   <resource file="org/apache/xerces/readers/xcatalog.dtd" />
>
>
>
>
>
>
>   <resource>
>     <patternset>
>       <include name="**/*.gif"/>
>       <exclude name="**/*.class"/>
>
>     </patternset>
>
>   </resource>
>
>
>
>   <classpath>
>     <pathelement location="lib/xerces.jar"/>
>     <pathelement location="lib/a_really_big_jar.jar"/>
>   </classpath>
> </genjar>
> This should extract all .gif files from the JAR files in the classpath
> and place them in the generated JAR file (test.jar).
> The problem is of course that I have no experience in programming Ant
> tasks and even though I've looked at the code in the <genjar> task I
> can't begin to imagine where to start.  So if anybody knows a good
> "task programming tutorial" or is willing to help me out with this
> problem I would be most greatful.
> Kind regards, Stefan Freyr
>
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:ant-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message