ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject RE: restrict and selector
Date Tue, 30 Jan 2007 16:00:09 GMT
--- Mikael Sitruk <MikaelS@Amdocs.com> wrote:

> 
> Matt 
> 
> I have tried the name too see:
> 
>       <restrict>
>           <union>
>             <fileset dir="D:\ant-test\dir1" />
>             <fileset dir="C:\TEMP\ant-test\dir2" />
>           </union>
>           <name name="*.txt"/>
>       </restrict>
> 
> But I got:
> 
> restrict doesn't support the nested "name" element.
> 	at
>
org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:356)
> 	at
>
org.apache.tools.ant.UnknownElement.handleChild(UnknownElement.java:566)
> 	at
>
org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:343)
> 	at
>
org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:198)
> ...
> 
> The restrict was part of a copy task
> 
> Can you help???

Actually, I can.  I neglected to mention--it's
documented, though possibly easy to miss, in the
manual:  the built-in resource selectors are not
explicitly defined as types in Ant's "base" namespace.
 The manual says:

Several built-in resource selectors are available in
the internal antlib
org.apache.tools.ant.types.resources.selectors:

This means that to use <name> et al, you must qualify
the element with its namespace.  e.g., you might use

  <restrict>
    <union>
      <fileset dir="D:\ant-test\dir1" />
      <fileset dir="C:\TEMP\ant-test\dir2" />
    </union>
    <name name="*.txt"
xmlns="antlib:org.apache.tools.ant.types.resources.selctors"
/>
  </restrict>

or, if you use selectors more often (I prefer this
method with all my antlib usage):

<project ...
xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors">

  <restrict>
    <union>
      <fileset dir="D:\ant-test\dir1" />
      <fileset dir="C:\TEMP\ant-test\dir2" />
    </union>
    <rsel:name name="*.txt" />
  </restrict>

</project>

HTH,
Matt

> 
> Mikael.S
> -----Original Message-----
> From: Matt Benson [mailto:gudnabrsam@yahoo.com] 
> Sent: Monday, 29 January, 2007 19:16
> To: Ant Users List
> Subject: Re: restrict and selector
> 
> 
> --- Mikael Sitruk <MikaelS@Amdocs.com> wrote:
> 
> > 
> > Hi
> > 
> >  
> > 
> > I’ve tried to use selector into a restrict
> > resource collection, but ant does not allow it,
> > indicating that the element (the selector used) is
> > not supported. Any suggestion?
> 
> Mikael:  it looks like you are trying to use the
> <filename> FILE selector where you probably want the
> <name> RESOURCE selector:  i.e. <restrict> doesn't
> understand File selectors, only Resource selectors.
> 
> HTH,
> Matt
> 
> > 
> >  
> > 
> > Sample:   
> > 
> > <restrict>
> > 
> >   <union>
> > 
> >     <fileset dir="Dir1"/>
> > 
> >     <fileset dir="Dir2"/>
> > 
> >     <fileset dir="Dir3"/>
> > 
> >   </union>
> > 
> >   <filename name=”xxx.x”/>
> > 
> > </restrict>
> > 
> >  
> > 
> > 10x
> > 
> > Mikael Sitruk
> > 
> > Amdocs Java Foundation
> > 
> >  
> > 
> > 
> > This message and the information contained herein
> is
> > proprietary and confidential and subject to the
> > Amdocs policy statement,
> > you may review at
> > http://www.amdocs.com/email_disclaimer.asp
> > 
> 
> 
> 
>  
>
____________________________________________________________________________________
> Do you Yahoo!?
> Everyone is raving about the all-new Yahoo! Mail
> beta.
> http://new.mail.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 
> This message and the information contained herein is
> proprietary and confidential and subject to the
> Amdocs policy statement,
> you may review at
> http://www.amdocs.com/email_disclaimer.asp
> 



 
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 

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


Mime
View raw message