On 3/26/07, Simon <[EMAIL PROTECTED]> wrote:
Hello all, What is the best way to resolve the specific dependencies of a particular artifact into a path or fileset for use in Ant? For example, I have a war file (just one of the possible outputs from my project) which depends on A.jar, and A.jar depends on B.jar and C.jar. When I build my war file, I need to include those dependencies - it would be great if this could be completely computed from the ivy resolve process so that if the dependencies of A.jar change I won't need to change anything in the build for this project. I see there are two tasks that come close ( cachefileset and cachepath ) but they don't seem to match perfectly and also the docs recommend it's better not to use them .... so just wondering how everyone else is doing this?
The doc recommend the use of the retrieve task which makes your build more independent from Ivy: once you have called retrieve, your build looks exactly the same as any other Ant build. But we should update this doc because it's not a strong recommendation, we should only indicate that if you want to have a build not too dependent on Ivy, you should prefer retrieve. Anyway, in your case you can use either cachepath, cachefileset or retrieve. The difference between cachefileset and cachepath is slight, it's only the data types created by those tasks: the first create a fileset, the second a path. Depending on your needs, you might prefer one or the other. The retrieve task is different, it copies the artifacts in the location you want (for example a lib directory), then you can use regular ant datatypes like path or fileset to do what you want with those artifacts. In your case, if you use the Ant war task to package your war, this task takes a fileset for its lib. So you can either use the ivy:cachefileset task to create this fileset, or the retrieve task to copy all required artifacts in a lib directory that you can then include in your war using the regular fileset facility of Ant. HTH, - Xavier Thanks for any advice!
Cheers, Simon.
