ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KDu...@escholar.com
Subject fileset and filename under copy task
Date Wed, 21 Feb 2007 14:43:05 GMT
>From my reseach/reading, in this example

     <copy todir="${bin}">
       <fileset dir="${src}">
         <filename name="hibernate.cfg.xml"/>
         <filename name="**/*.hbm.xml"/>
         <filename name="**/*.html"/>
       </fileset> 
     </copy>

a file to be included would have to meet the three filename conditions.
The filename conditions are "AND"ed.  So I think I understand why 
the above does not work.



The following copies the files, as expected. 
     <copy todir="${bin}">
          <fileset dir="${src}" casesensitive="false" >
        <or>
              <depth max="3"/>
              <filename name="./**/*.html"/>
              <filename name="hibernate.cfg.xml"/>
              <filename name="./**/*.hbm.xml"/>
        </or>
         </fileset> 
     </copy>


But this does not.  And I do not understand why it does not work.
     <copy todir="${bin}">
         <fileset dir="${src}">
        <selector>
            <or>
                <filename name="hibernate.cfg.xml"/>
                <filename name="./**/*.hbm.xml"/>
               <filename name="./**/*.html"/>
             </or>
         </selector> 
       </fileset> 
     </copy>


Hope somebody can shed some light on what is going on here.

Thanks



KBD



"bill/wilandra" <bill@wilandra.com> 
02/20/2007 06:04 PM
Please respond to
"Ant Users List" <user@ant.apache.org>


To
"'Ant Users List'" <user@ant.apache.org>
cc

Subject
RE: fileset  and filename under copy task






>From the examples in the 1.6.5 manual I would assume that the following
should work. I did not try it.
     <copy todir="${bin}">
       <fileset dir="${src}">
         <filename name="hibernate.cfg.xml"/>
         <filename name="**/*.hbm.xml"/>
         <filename name="**/*.html"/>
       </fileset> 
     </copy>

HTH Bill
-----Original Message-----
From: KDuffy@escholar.com [mailto:KDuffy@escholar.com] 
Sent: Tuesday, February 20, 2007 11:55 AM
To: user@ant.apache.org
Subject: fileset and filename under copy task

Hello:

I am tring to do something simple.

I want to copy files from from one directory to another by listing 
specific groups of file   ie *.XML  or *.html

The follwing works:
  <target  name="SAVE2copy_other">
     <echo>
         Copy Other Files
 
     </echo>
 
     <copy todir="${bin}">
                <fileset dir="${src}" casesensitive="false" >
                  <exclude name="**/*.java"/>
                </fileset> 
     </copy>
  </target>


But this uses an exclude, I want to specify the files to be copied.

This does NOT work:

 <target  name="copy_other">
     <echo>
         Copy Other Files
         ${bin}
         ${src}
 
     </echo>
 
     <copy todir="${bin}">
         <fileset dir="${src}">
        <selector>
            <or>
                <filename name="hibernate.cfg.xml"/>
                <filename name="./**/*.hbm.xml"/>
               <filename name="./**/*.html"/>
             </or>
         </selector> 
       </fileset> 
     </copy>
  </target>


Produces the following output:


C:\dev\eclipse\metaDataExport>ant copy_other  -debug Apache Ant version
1.6.5 compiled on June 2 2005
Buildfile: build.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.5 in: c:\progra~1\java\jdk1.5.0_10\jre Detected 
OS:
Windows XP Adding reference: ant.ComponentHelper Setting ro project
property: ant.version -> Apache Ant version 1.6.5 compiled on June 2 2005
Setting ro project property: ant.file ->
C:\dev\eclipse\metaDataExport\build.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile C:\dev\eclipse\metaDataExport\build.xml with URI =
file:///C:/dev/eclipse/metaDataExport/build.xml
Setting ro project property: ant.file.null ->
C:\dev\eclipse\metaDataExport\build.xml
Project base dir set to: C:\dev\eclipse\metaDataExport
 +Target:
Adding reference: db2JDBC
Adding reference: hibernate3.2
 +Target: main
 +Target: init
 +Target: compile
 +Target: copy_other
 +Target: jarit
 +Target: SAVEcopy_other
 +Target: SAVE2copy_other
Setting project property: message -> Building the .jar file.
Setting project property: src -> ./src/
Setting project property: bin -> ./bin/
Setting project property: hibernate3.2_base -> C:\hibernate-3.2\ Setting
project property: db2JDBCdriver_base -> C:\Program Files\IBM\SQLLIB\java\
Could not load a dependent class
(com/sun/media/jai/codec/FileSeekableStream) for type image Could not load 
a
dependent class (com/jcraft/jsch/UserInfo) for type sshexec Could not load 
a
dependent class (com/jcraft/jsch/UserInfo) for type scp Adding reference:
db2JDBC Could not load a dependent class
(com/sun/media/jai/codec/FileSeekableStream) for type image Could not load 
a
dependent class (com/jcraft/jsch/UserInfo) for type sshexec Could not load 
a
dependent class (com/jcraft/jsch/UserInfo) for type scp Adding reference:
hibernate3.2 Attempting to create object of type
org.apache.tools.ant.helper.DefaultExecutor
Adding reference: ant.executor
Build sequence for target(s) `copy_other' is [copy_other] Complete build
sequence is [copy_other, init, compile, jarit, main, SAVEcopy_other,
SAVE2copy_other, ]

copy_other:
     [echo]
     [echo]          Copy Other Files
     [echo]          ./bin/
     [echo]          ./src/
     [echo]
     [echo]
Could not load a dependent class
(com/sun/media/jai/codec/FileSeekableStream) for type image Could not load 
a
dependent class (com/jcraft/jsch/UserInfo) for type sshexec Could not load 
a
dependent class (com/jcraft/jsch/UserInfo) for type scp Could not load a
dependent class (jdepend/xmlui/JDepend) for type jdepend Could not load a
dependent class (junit/framework/Test) for type junit
fileset: Setup scanner in dir C:\dev\eclipse\metaDataExport\src with
patternSet{ includes: [] excludes: [] }
     [copy] hibernate.cfg.xml omitted as hibernate.cfg.xml is up to date.

BUILD SUCCESSFUL
Total time: 0 seconds
C:\dev\eclipse\metaDataExport>



need some assistance.

thanks



kbd



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


_____________________________________________________________________________
Scanned by IBM Email Security Management Services powered by MessageLabs. 
For more information please visit http://www.ers.ibm.com
_____________________________________________________________________________


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message