On Tue, Apr 28, 2009 at 5:04 PM, Alan Chaney <alan@writingshow.com> wrote:
I wouldn't claim to be an Ivy expert, but I have had a similar problem.

You don't say how your ivy:retrieve is configured. Ivy is fundamentally a two step process:

1. Resolve the *project* dependencies required (which puts them in the ivy cache)
2. Retrieve the artifacts to a location you specify.

You can bypass step2 by configuring your classpath to include the ivy:cachepath output for compiles etc, but you normally need to retrieve them when building and deploying your own artifacts.

I suspect that you using ivy:retrieve to place your depedency artifacts in a local location (such as a 'lib' folder) and that what is happening is that the 'old' versions are still there when you retrieve a later version. I had a similar problem assembling jars for a war file, and found that what I need to do was to simply clear the target folder using an Ant 'delete' task, configured appropriately of course.

Or, I may have completely misunderstood what it is that you doing, in which case I apologize!


Alan Chaney

Hi Alan,

Thanks for your reply.

I'm terrible at posting to these lists, so I apologise for not describing my situation better.

My ant task, aptly named 'get-dependencies' does the following:

    <target name="get-dependencies" >
        <taskdef resource="org/apache/ivy/ant/antlib.xml"
         uri="antlib:org.apache.ivy.ant" classpathref="classpath-support"/>
        <ivy:settings file="./ivysettings.xml" />
        <ivy:retrieve log="${ivy.loglevel}" />

Currently there are no project-specific dependencies, just artifacts (JARs). What you're describing does seem to relate to what I'm doing, but I actually don't want to delete the lib directory as we're in a large team here and I'd like dependency management to be as transparent as possible - some people may have be using a lib dir for a dependency not currently configured in Ivy.

What I've been looking at over the past few hours (!!!) is the conflict element in an IVY file and the latest-revision strategy and relevant conflict manager. I'm assuming that this applies to artifact resolution, as they still have an org and a module. Unfortunately I haven't had any luck and I've actually come across an issue where Ivy's schema validation for my ivy.xml is invalid when using the <conflict> element. I'll ignore that for now as I'm 99% sure it's just my misunderstanding ( Invalid content was found starting with element 'dependency'. One of '{conflict}' is expected. etc). I was hoping that the duplicate JAR files (some-build-123.jar and some-build-124.jar) would trigger a conflict but no such thing occured.

I've attached my ivy.xml and ivysettings.xml file for reference - perhaps it'll shed some more light on what I'm doing wrong.


Alex Collins