A patternset is a series of includes and excludes that can be used over and
over again in  various filesets.  When you specify an empty patternset,
you're not specifying any exclude or includes. Thus, your fileset acts in
the default manner of:

<fileset dir="${mydir}>
</fileset>

I see what you want to. One possibility is to create the default patternset
that includes a bogus file:

<patternset id="mypatternset">
   <include name="bogus.file.foo.foo.foo"/>
</patternset>

<fileset dir="${mydir}">
   <patternset refid="mypatternset"
</fileset>

This will be an empty fileset, but if you add more includes in your
patternset, the other files will be included. I do this when I use a
macrodef that allow users to pass a set of files as a parameter. This way,
if they pass an empty parameter, I don't include any files.

On the other hand, I believe includes override excludes in a fileset. That
is, if you exclude everything, but then include specific files, your fileset
will include all your included files, but if you don't specify any includes,
your fileset will still be empty.

On Sun, Oct 4, 2009 at 6:26 AM, efe4itcc <efe4i...@gmail.com> wrote:

>
> Hi
>
> Env: JDK 1.6.0, ANT 1.7.1
>
> I spend some time figuring out a classpath dependancy problem in my build
> file, and finally cornered the cause to the surprinsing file selection of
> <fileset> when using the following syntax.
>
> <patternset id="mypatternset">
> </patternset>
> <path id="path.main.compile">
>  <fileset dir="${mydir}">
>    <patternset refid="mypatternset"/>
>  </fileset>
> </path>
>
> The above syntax make "path.main.compile" contains all files under
> ${mydir}.
> Is patternset applying an implicit <include name="**"/> ?
> Is fileset discarding the patternset as it does not declare any pattern ?
> Is that the intended behavior?
>
>
> To fix the problem, I just have to be more specific in the patternset
> definition, such as:
> <patternset id="mypatternset">
>   <exclude name="**"/>
> </patternset>
>
> This example might seem of no use :)
> However I use this path reference to designate a project's dependencies to
> other of our projects, and some projects are standalone, so I need an empty
> patternset for them.
>
>
> Regards
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Fileset-with-%22empty%22-patternset-selects-all-files-instead-tp25736704p25736704.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
> For additional commands, e-mail: user-h...@ant.apache.org
>
>


-- 
David Weintraub
qazw...@gmail.com

Reply via email to