I'm looking into using Ivy to manage dependencies but wow - that thing really likes to make multiple copies of jars! It spreads like the ivy in my back yard and is just as undesirable!
Is it possible to have Ivy simply define a classpath (for a specified profile) that references the resolved dependencies so my javac can reference them directly in the ivy repository (or cache?).
I've read the reference docs buy only see the option to set up symbolic links to the repository cache. I guess this will suffice, but it seems like a waste. Also, I'm not sure that a "war" task can build the war from symbolic links... but I guess I'll find out when I give it a try.
Any better suggestions?
After battling through the badly written Ivy documentation (sigh - what is wrong with these people? - did they not attend high-school literacy classes in any language?), I see there is a post-resolve task called cachepath that will construct an ant path to the resolved dependency artifacts instead of copying files to a lib directory. This might be just what I'm looking for!
Here's my standard Java build file that creates an executable
jar
.The objective is to manage project specific stuff via a combination of ANT properties and an
ivy.xml
file for the 3rd-party dependencies.As you've discovered in the Ivy docu, the
cachepath
Ivy task is used to manage two ANT paths. One for the build dependencies the other for the run-time dependencies of the executablejar
.The real power of Ivy is in something called
configurations
. I found it difficult to grasp initially until I realised it was simple a logical grouping ofjar
s that I can define for my project. This example has twoconfigurations
:build
runtime
Here's the ivy file demonstrating how dependencies can be associated with
configurations
:In conclusion I hope this example helps in understanding Ivy. I like the way it concentrates on only one thing, the management of 3rd-party dependencies.
Just to augment @Mark's answer.
Note that
cachepath
result can also be directly used in build without the need to copy jars withretrieve
: