As much as you used the <exclude> element you can use an <include> element to 
define which files 'to include'

Something like

<target name="SAVE2copy_other"> 
<echo> 
Copy Other Files 

</echo> 

<copy todir="${bin}"> 
<fileset dir="${src}" casesensitive="false" > 
<exclude name="**/*.java"/> 
<include name="**/*.XML"/>
<include name="**/*.html"/>
</fileset> 
</copy> 
</target> 



----- Original Message ---- 
From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> 
To: user@ant.apache.org 
Sent: Tuesday, February 20, 2007 1:54:44 PM 
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


 
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to