File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Engineering
»
Ant, Maven and Other Build Tools
Author
Ant copy with fileset
Micale Raj
Ranch Hand
Joined: Jul 01, 2009
Posts: 30
I like...
posted
May 07, 2012 04:00:35
0
Hi All,
I want to copy files using fileset like following,
<fileset id="test"> <include name="commons-lang-2.1.jar"/> </fileset> <target name="def"> <copy todir="jar/"> <fileset dir="target/layout/lib"> <exclude refid="test"/> </fileset> </copy> </target>
(This code don't work.)
In the copy task I want to include/exclude previously defined fileset. How to do this ?
Thanks !
Peter Johnson
author
Bartender
Joined: May 14, 2008
Posts: 5536
I like...
posted
May 07, 2012 08:44:53
0
You can't - a fileset is evaluated at the time it is encountered ans a collection of files is built at that time.
What you want, on the other hand, is to create a list of file names and apply that name in multiple locations. Something like this should work:
<property name="test.jars" value="commons-lang-2.1.jar"/> <target name="def"> <copy todir="jar/"> <fileset dir="target/layout/lib"> <exclude name="${test.jars}"/> </fileset> </copy> </target>
Note that "exclude" allows a comma-separated list of file name
patterns
, so you specific multiple JARs.
JBoss In Action
Micale Raj
Ranch Hand
Joined: Jul 01, 2009
Posts: 30
I like...
posted
May 07, 2012 22:19:48
0
Thank you very much Peter. Your post helped me resolve the problem. Thanks again !
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: Ant copy with fileset
Similar Threads
Test class should have exactly one public constructor
WAR file creation using Ant in Java Program
How do you compile java program?
Building Seam projects in Eclipse
Axis 2 tutorial - client class compliation error
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter