ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefán Freyr Stefánsson <>
Subject Custom Task with nested Patternset
Date Thu, 17 Jan 2002 16:09:39 GMT
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" />

      <include name="**/*.gif"/>
      <exclude name="**/*.class"/>



    <pathelement location="lib/xerces.jar"/>
    <pathelement location="lib/a_really_big_jar.jar"/>
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:   <>
For additional commands, e-mail: <>

View raw message