On 10/30/07, Nascif Abousalh-Neto <[EMAIL PROTECTED]> wrote: > > Hi all, > > We are reading the resolved module descriptor generated in the ivy cache
To be clear for others reading, we don't call that a module descriptor, but a resolution report. A module descriptor cointains metadata about a module (usually an ivy file or a pom), while the resolution report contains much more information about how the resolution of dependencies of a module configuration has been performed. to extract information about the complete list of dependencies, both > names and versions, for an internal process that requires them in a > simple text file. I created a simple XSLT transformation to capture > those values, but we found that sometimes there are multiple "revision" > nodes for the same "module" - the only difference being the value of the > attribute "search", as in the example below. The search attribute only indicates if the module required a look up in the repository to find it or not. This is usually the case either if your use a dynamic version (latest.integraiton for instance). According to the file extract you provide below, I'd say this is a bug in Ivy, you shouldn't have twice the same revision. I think we end up with twice the revision because during dependency resolution we end up with an IvyNode for this module revision being referenced twice in the nodes map: one for 4.2.0.20071030042610, and one for latest.integration. But we should do a better work when generating the xml, to output this IvyNode only once. So the best is not to solve the problem in your XSLT but in Ivy. Could you open a bug in JIRA? Xavier The result is that in those cases is that I have multiple lines for > version. So clearly I need to add another test in the XSLT. My question > is, how do I find which revision is the one that was actually selected? > I already have a check to skip "evicted-by", is that any other test that > would give me the correct result? > > I think I need to look for 'searched="true"' in my XPath check, but I am > not sure. Any suggestions? > Thanks, > Nascif > > Example with multiple entries: > > <module organisation="SAS" name="sas.web.framework" > resolver="sas-example"> > <revision name="4.2.0.20071030042610" status="integration" > pubdate="20071030042635" resolver="ivyfiles" artresolver="sas-example" > downloaded="false" searched="true" default="false" conf="compile" > position="64"> > <caller organisation="SAS" name="sas.portal.persistence.impl" > conf="compile" rev="latest.integration"/> > <caller organisation="SAS" name="sas.portal.persistence" > conf="compile" rev="4.2.0.20071030042610"/> > <artifacts> > <artifact name="sas.web.framework" type="jar" ext="jar" > status="successful" size="762034"> > </artifact> > </artifacts> > </revision> > <revision name="4.2.0.20071030042610" status="integration" > pubdate="20071030042635" resolver="ivyfiles" artresolver="sas-example" > downloaded="false" searched="false" default="false" conf="compile" > position="64"> > <caller organisation="SAS" name="sas.portal.persistence.impl" > conf="compile" rev="latest.integration"/> > <caller organisation="SAS" name="sas.portal.persistence" > conf="compile" rev="4.2.0.20071030042610"/> > <artifacts> > <artifact name="sas.web.framework" type="jar" ext="jar" > status="successful" size="762034"> > </artifact> > </artifacts> > </revision> > > Here is the current XSLT: > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:output method="text" encoding="iso-8859-1"/> > <xsl:param name="curr_project"></xsl:param> > <xsl:param name="curr_version">.</xsl:param> > <xsl:template match='/ivy-report/dependencies'> > PickList-Version=1 > > name=<xsl:value-of select="$curr_project"/> > version= <xsl:value-of select="$curr_version"/> > > <xsl:for-each select="module"> > name=<xsl:value-of select="@name"/> > <xsl:for-each select="revision"> > <xsl:choose> > <xsl:when test="evicted-by"> > ## (evicted) version=<xsl:value-of select="@name"/> > </xsl:when> > <xsl:otherwise> > version=<xsl:value-of select="@name"/> > </xsl:otherwise> > </xsl:choose> > </xsl:for-each> > <xsl:text> > </xsl:text> > </xsl:for-each> > <xsl:text> > </xsl:text> > </xsl:template> > </xsl:stylesheet> > -- Xavier Hanin - Independent Java Consultant http://xhab.blogspot.com/ http://ant.apache.org/ivy/ http://www.xoocode.org/
