File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes ant paths and files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ant paths and files" Watch "ant paths and files" New topic
Author

ant paths and files

John Cattanach
Greenhorn

Joined: May 29, 2007
Posts: 2
Hi, this is driving me nuts - is there anyway to use a path-like structure in a copy task?

Scenario is I have a classpath reference which I use for compiling. I'm building a war, so I also need to copy these files into WEB-INF/lib. It would be nice if I only had to define the list of jars once, but as afar as I can determine, if the jars are in multiple directories I cannot use any ant type which can be both path-like and input to <copy> .

I can get around it by copying the files first, then referencing the WEB-INF/lib during the compiling. But to my mind it would be much neater to have a single <files id="externaljars" .... definition.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

John,
A <classpath> can contain a fileset element. So you could create a path that contains a single fileset with a reference to your standalone fileset.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
In fact, the copy task supports resource collections as inner elements, so you can use a path inside the copy task, too.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

Ilja,
Is that from the resource framework that was introduced with Ant 1.7? Some people are still on 1.6. I infer that John is from his description of the problem.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Jeanne Boyarsky:
Ilja,
Is that from the resource framework that was introduced with Ant 1.7? Some people are still on 1.6. I infer that John is from his description of the problem.


Could be, could be...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ant paths and files
 
Similar Threads
Of paths, patternsets, and filesets
ant javac task not copying directory with no java files
Deployment error NoClassDefFoundError: org.hibernate.cfg.Configuration on Oracle 11g App Server
ECLIPSE, ANT and generating WAR files...
Ant: How to place resource files into bottom of package level structure?