ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Custom Task with nested Patternset
Date Fri, 18 Jan 2002 07:14:32 GMT
On Thu, 17 Jan 2002, Stefán Freyr Stefánsson <> wrote:

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

Hmm, take a look at some current nightly build of Ant.  You will need
BCEL (find it at Jakarta) then you can use the new data type
<classfileset> - I think it doesn't have any documentation yet.

You'd define it outside any task as

<classfileset id="use-later" dir="your-class-hierarchy-base-dir">
  <root classname="" />
  <root classname="" />

and it will result in something you can use inside a <jar> task as

<jar ....>
  <fileset refid="use-later" />

This "something" contains the .class files for the classes you've
specified in the <root> elements as well as all classes these classes
depend upon.

> 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).

Here you could simply use yet another <fileset> to specify them inside
the jar task, which already supports include/exclude logic.

OK, I know this doesn't answer the question of how to make some task
support nested patternsets.  The short answer is that the class that
corresponds to the element you want to support <patternset> needs to
either have

public void addPatternset(


public void addConfiguredPatternset(


public createPatternset()

see <>.


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

View raw message