| Author |
Copy dependent jars
|
Mark Bates
Greenhorn
Joined: Apr 26, 2004
Posts: 2
|
|
Hey everyone, long time listener, first time caller.... I'm building a war file for deployment, and i would like to ant to copy only jars that i'm dependent on into my WEB-INF/lib directory. Does anybody know how to do this? We use quite a few frameworks that come with all sorts of libs, and i would really like to trim out the fat when i depoly. so instead of say 10 jars i know only have 3. This would be huge if someone knew either how to do this, or could point me to a 3rd party task that does this. Thanks all. -Mark
|
 |
Guy Allard
Ranch Hand
Joined: Nov 24, 2000
Posts: 776
|
|
Hi Mark - check out 'fileset' in the ant docs. They are here: ant docs Regards, Guy
|
 |
Mark Bates
Greenhorn
Joined: Apr 26, 2004
Posts: 2
|
|
thanks, but fileset is not exactly what i'm looking for. i want to say have a whole directory of say 50 jar files and pass that it and have it tell me that i only need 20 of those files for compilation and deployment, and then have it copy the 20 i do need into my war file. does that make sense? of course if fileset can do this, i would love to know how. thanks for your help. -mark
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
Welcome to JavaRanch, Mark! I've not seen anything built into Ant that can do what you're wanting to do. Sometime ago, I think I did read a thread where someone described making or using a tool or simple utility method that allowed them to dynamically (at runtime) discover the location of a class definition that was loaded by a class loader. I don't have a link with more information. You might get lucky with a search on the Intermediate or Advanced forums. If you're interested to figure out building your own such tool, a GREEDY-SET-COVER type of algorithm would probably get the job done pretty well. Although, that might be overkill in a situation like this, where you likely don't have much overlap (that is, where you don't have the same class definition in more than one JAR occurring very often - if at all). But... Why do you have a big pool of JARs that includes ones you don't use? Perhaps it would be simplest to just change that set up. When I put together my projects, I don't include a JAR file in my build path, unless I'm using something in it. [ May 06, 2004: Message edited by: Dirk Schreckmann ]
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
Guy Allard
Ranch Hand
Joined: Nov 24, 2000
Posts: 776
|
|
Well, worst come to worst, seems to me you can just code all the jar names in tags for the . Ugly, not generalized, but it would work. If you have a large collection of jars in one location, multiple projects each of which use only a subset of those, you might take a look at maven as a wrapper around ant for a build tool. Guy
|
 |
 |
|
|
subject: Copy dependent jars
|
|
|