You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Fiedler, Raul" <Ra...@ecb.int> on 2001/08/16 17:30:41 UTC

passing fileset as a property

"yeah, I've been trying to do this too. Is this feature beyond the
capabilities of Ant?"

I am looking for possibility to define a group of filees (fileset) as a
property and perform different task with it.
Example jar fileset or delete fileset.

Is there another approach to it or maybe add this one to suggestions for ANT
1.5???

Thanks a lot.
Raul

cnsxxx09@netscape.net wrote:
>Hi,

>I know I can use the 'includes' in the <jar> tag and also include a
basedir, but the META-INF doesn't live in the basedir, and besides this
whole approach is m-ugly when compared to the concept of FileSets.

>Any suggestions on how to accomplish this?

>Thanks IA

>C.
--

cnsxxx09@netscape.net wrote:

>Hi,
>
>I have an EJB ant target that runs the Jar command over a specified set of
files.
>In order to make this really useful & re-usable I want to be able to
re-call it many times but passing in different filesets.
>
>>From the docs <path id="base.path"> and  <path refid="base.path"> look like
what I am looking for, but I cannot use the path tag within the jar
command/tag.
>
>Can someone point me in the right direction.
>
>TIA
>
>C.
>--

Any e-mail message from the European Central Bank (ECB) is sent in good faith but shall neither be binding nor construed as constituting a commitment by the ECB except where provided for in a written agreement.
This e-mail is intended only for the use of the recipient(s) named above. Any unauthorised disclosure, use or dissemination, either in whole or in part, is prohibited.
If you have received this e-mail in error, please notify the sender immediately via e-mail and delete this e-mail from your system.


Re: passing fileset as a property

Posted by Mitchell Ackermann <mi...@epsiia.com>.
Going one step further, you could have a patternset like
  <patternset id="pattern1">
    <include name="a.jar"/>
    <include name="b.zip"/>
    <include name="c.java"/>
    <include name="*"/>
    ...
  </patternset>
(hopefully you wouldn't use jar and zip and java files all at the same time; just an example)

Then, you could create multiple filesets in different directories with that same pattern:

  <fileset dir="${dir1}" id="fileset1">
    <patternset refid="pattern1"/>
  </fileset>

  <fileset dir="${dir2}" id="fileset2">
    <patternset refid="pattern1"/>
  </fileset>

I use this sometimes with a patternset like
  <patternset id="files">
    <include name="Class1.*"/>
    <include name="Class2.*"/>
    <include name="Class3.*"/>
  </patternset>

Then I use that pattern to reference .java files in a source directory, and .class files in a build directory.
And this is with Ant 1.3.

Mitchell Ackermann


----- Original Message ----- 
From: Matthew Inger <ma...@sedonacorp.com>


Fiedler, Raul wrote:

>"yeah, I've been trying to do this too. Is this feature beyond the
>capabilities of Ant?"
>
>I am looking for possibility to define a group of filees (fileset) as a
>property and perform different task with it.
>Example jar fileset or delete fileset.
>

I would try creating the filesets, and assigning them id's.  Then you 
could pass
in the id as a paramter to a function, and do your stuff:

<fileset id="abc" .. >
 ...
</fileset>

<target name="delete_fileset">
  <delete>
    <fileset refid="${filesetid}" />
  </delete>
</target>

<target name="test">
  <antcall target="delete_fileset">
    <parameter name="filesetid" value="abc" />
  </antcall>
</target>



Re: passing fileset as a property

Posted by Matthew Inger <ma...@sedonacorp.com>.
Matthew Inger wrote:

> Fiedler, Raul wrote:
>
>> "yeah, I've been trying to do this too. Is this feature beyond the
>> capabilities of Ant?"
>>
>> I am looking for possibility to define a group of filees (fileset) as a
>> property and perform different task with it.
>> Example jar fileset or delete fileset.
>>
>> Is there another approach to it or maybe add this one to suggestions 
>> for ANT
>> 1.5???
>>
>> Thanks a lot.
>> Raul
>>
>
> I would try creating the filesets, and assigning them id's.  Then you 
> could pass
> in the id as a paramter to a function, and do your stuff:
>
> <fileset id="abc" .. >
> ...
> </fileset>
>
> <target name="delete_fileset">
>  <delete>
>    <fileset refid="${filesetid}" />
>  </delete>
> </target>
>
> <target name="test">
>  <antcall target="delete_fileset">
>    <parameter name="filesetid" value="abc" />
>  </antcall>
> </target>
>
>
> I'm not entirely sure this will work.  But it's worth a try.
> It all depends on how the refid attribute is processed, and whether
> or not it allows for variable expansion (ie. expanding "${filesetid}"
> into "abc").
>
>
>
by the way, this does work..........


-- 
Matt Inger (matt.inger@sedonacorp.com)
Sedona Corporation
455 S. Gulph Road, Suite 300
King of Prussia, PA 19406
(484) 679-2213
"Self-respect - the secure feeling that no one,
 as yet, is suspicious." -H.L. Mencken 




Re: passing fileset as a property

Posted by Matthew Inger <ma...@sedonacorp.com>.
Fiedler, Raul wrote:

>"yeah, I've been trying to do this too. Is this feature beyond the
>capabilities of Ant?"
>
>I am looking for possibility to define a group of filees (fileset) as a
>property and perform different task with it.
>Example jar fileset or delete fileset.
>
>Is there another approach to it or maybe add this one to suggestions for ANT
>1.5???
>
>Thanks a lot.
>Raul
>

I would try creating the filesets, and assigning them id's.  Then you 
could pass
in the id as a paramter to a function, and do your stuff:

<fileset id="abc" .. >
 ...
</fileset>

<target name="delete_fileset">
  <delete>
    <fileset refid="${filesetid}" />
  </delete>
</target>

<target name="test">
  <antcall target="delete_fileset">
    <parameter name="filesetid" value="abc" />
  </antcall>
</target>


I'm not entirely sure this will work.  But it's worth a try.
It all depends on how the refid attribute is processed, and whether
or not it allows for variable expansion (ie. expanding "${filesetid}"
into "abc").



-- 
Matt Inger (matt.inger@sedonacorp.com)
Sedona Corporation
455 S. Gulph Road, Suite 300
King of Prussia, PA 19406
(484) 679-2213
"Self-respect - the secure feeling that no one,
 as yet, is suspicious." -H.L. Mencken