Hi Philipp, thanks for the detailed description of the problem :-) I've committed some changes in SVN trunk that should fix your issues.
Could you please give it a try to see if your problems has been fixed by my changes? Regarding the dependencies of jdom: they are all marked as optional. This means that in your experiment 1 and 2 you still won't get these (Ivy won't download the optional dependencies of transitive maven dependencies). However, experiment 3 should now also get these optional dependencies. thanks, Maarten ________________________________ From: Philipp Wetzler <[email protected]> To: [email protected] Sent: Wed, December 16, 2009 8:57:54 PM Subject: Re: relocation of transitive dependency All right, I've been running more experiments and I think I have narrowed down the problem significantly. I'm attaching a pared down ivy.xml, ivysettings.xml, build.xml, and the problematic pom file. I'm also attaching the output of "resolve" for 4 representative experiments which I ran using a local filesystem repository to hold the simplified cleartk-test-util pom. These experiments are: 1) My project (in ivy.xml) depends only on the pared down cleartk-test-util, which only depends on jdom:jdom:1.1. The resolve here FAILS, because it can't find the artifact for jdom:jdom:1.1 (instead of looking for it under org.jdom:jdom:1.1). 2) Same as 1, but I removed line 37 (<type>jar</type>, which I believe should be ignored anyway since that's the default value). The resolve here ends in SUCCESS, and the cleartk-test-util and jdom artifacts are resolved. 3) Ignoring cleartk-test-util, my project depends only on jdom:jdom:1.1. The resolve succeeds, Ivy correctly looks for the artifact under org.jdom:jdom:1.1. The jdom artifact is resolved. 4) Same as 3, but instead of jdom:jdom:1.1 my project now depends on org.jdom:jdom:1.1. As expected, the resolve succeeds, Ivy finds the jdom artifact under org.jdom:jdom:1.1. But only in this experiment does Ivy also resolve the dependencies of jdom (xercesImpl, xmlParserAPIs, jaxen-core, jaxen-jdom, saxpath, xalan). This is what should happen in all 4 experiments. It seems to me that two things are going wrong here: First, when <type>jar</type> is specified in the pom of the direct dependency, relocation isn't properly handled in the transitive dependency. Second, whenever a relocation pointer is followed during resolution, the dependencies of the relocated dependency are ignored. All of the experiments were run after deleting ~/.ivy2/cache/*, and using the snapshot version of Ivy that I downloaded yesterday. Philipp On Tue, Dec 15, 2009 at 5:50 PM, Philipp Wetzler <[email protected]> wrote: On Tue, Dec 15, 2009 at 4:55 PM, Maarten Coene <[email protected]> wrote: > >>>I don't have a problem when I add a dependency on this cleartk-test-util >>>module. >> >>>>What version of Ivy are you using? >>>>If you are using the latest released version, could you try again with a >>>>snapshot build? >>>>You can download snapshot builds here: >>>>http://hudson.zones.apache.org/hudson/view/Ant/job/Ivy/ > > >Sorry for the delay. I've been experimenting with various different setups. I >did download and install the most recent snapshot (2.2.0.20091208210308), and >between every resolve I deleted the Ivy cache. > > >First of all, after trying to trim down my ivysettings.xml I realized that I >had been using a slightly different version of the pom, which was being pulled >from a local repository. Unfortunately that version of the pom was deleted >during my experiments, so I don't have it anymore. Using the online version of >the pom the resolve worked. > > >One difference in the pom files was that, in addition to specifying the >groupId, artifactId and version elements for jdom, the local copy also >specified <optional>false</optional> and <type>jar</type>, which as I >understand it are simply the default values. Strangely, when I removed these >extra elements (no other change) the resolve worked as it should, properly >handling the relocation. > > >On the other hand, if I copy the pom that's online to the local repository and >_add_ those extra elements, the resolve still works fine, so there must be >something else.... > > >> >I realize this is not exactly helpful. At this point, without the original >problematic pom, I haven't been able to reproduce this error anymore, but it >might show up again with other packages. From a user's perspective, it would >be nice to have a better way of diagnosing such dependency issues, for example >seeing which transitive dependencies are added and why. If there's a way to do >that, I haven't been able to find it in the documentation. > > >I'll be experimenting more with this tomorrow and will let you know if the >problem shows up again. Thanks a lot for your help so far! > > > > >Philipp > > > > > > >>>>----- Original Message ---- >>>>From: Philipp Wetzler <[email protected]> >>>>To: [email protected] >> >>Sent: Wed, December 16, 2009 12:44:17 AM >>>>Subject: Re: relocation of transitive dependency >> >>>>On Tue, Dec 15, 2009 at 4:32 PM, Maarten Coene >>>><[email protected]>wrote: >> >>>>> Do you have an example of a public pom that has a dependency on org=jdom >>>>> 1.1 ? >>>>> >> >>>>This is one I've been confronted with: >> >>>>http://cleartk.googlecode.com/svn/repo/org/cleartk/cleartk-test-util/0.1/cleartk-test-util-0.1.pom >> >>>>BTW, when building a Maven project that also depends on this, the problem >>>>doesn't occur, so it seems that this is either due to my Ivy configuration >>>>or Ivy itself. >> >> >>>>Philipp >> >> >> >>>>> ----- Original Message ---- >>>>> From: Philipp Wetzler <[email protected]> >>>>> To: [email protected] >>>>> Sent: Wed, December 16, 2009 12:22:50 AM >>>>> Subject: relocation of transitive dependency >>>>> >>>>> Hello, >>>>> >>>>> I've started using Ivy recently in order to better integrate one of my Ant >>>>> based projects with it's Maven dependencies. >>>>> >>>>> Now I ran into a problem that I haven't been able to figure out: One of my >>>>> Maven dependencies depends on jdom (org=jdom, name=jdom, rev=1.1). JDom >>>>> 1.1 >>>>> is actually published under org=org.jdom, but there's a relocation record >>>>> under org=jdom. When I do a resolve on my project, however, Ivy ignores >>>>> the >>>>> relocation record and attempts (and fails) to download the nonexistent jar >>>>> from org=jdom (from repo1.maven.org). >>>>> >>>>> Interestingly, when I remove the Maven dependency from my project and add >>>>> JDom 1.1 as a direct dependency, Ivy manages to resolve it correctly using >>>>> either org value, so it seems that this problem only occurs when the >>>>> relocated dependency is a transitive one. >>>>> >>>>> How would I go about diagnosing this problem? I tried doing a resolve with >>>>> the verbose / debug flags, but the additional information didn't seem >>>>> helpful to me. >>>>> >>>>> Thanks for any suggestions >>>>> >>>>> >>>>> Philipp >>>>> >>>>> >>>>> >>>>> >>>>> >> >> >> >> >> >
