ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Liu (JIRA)" <>
Subject [jira] Created: (IVY-1236) Dynamic version resolution result is incorrect when ivy metadata contains extra attributes.
Date Fri, 08 Oct 2010 03:45:30 GMT
Dynamic version resolution result is incorrect when ivy metadata contains extra attributes.

                 Key: IVY-1236
             Project: Ivy
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.2.0
            Reporter: Tom Liu

Ivy resolution is incorrect given the following configuration:

ivy metadata of logging#slf4j;1.6.1
<ivy-module version="2.0" xmlns:extra="">
    <info organisation="logging" module="slf4j" revision="1.6.1" extra:tag="logging">
	<description>Front end logging API.</description>
       <conf name="runtime" description="Core runtime dependencies"/>
       <conf name="jcl-bridge" extends="runtime" description="Jakarta Commons Logging Bridge
       <conf name="jul-bridge" extends="runtime" description="Java Util Logging Bridge
       <conf name="log4j-bridge" extends="runtime" description="Apache Log4J Bridge dependencies"/>
       <conf name="bridges" extends="jcl-bridge,jul-bridge,log4j-bridge" description="Groups
all logging bridge dependencies"/>
       <artifact name="slf4j-api-1.6.1" type="jar" ext="jar" conf="runtime"/>
       <artifact name="jcl-over-slf4j-1.6.1" type="jar" ext="jar" conf="jcl-bridge"/>
       <artifact name="jul-to-slf4j-1.6.1" type="jar" ext="jar" conf="jul-bridge"/>
       <artifact name="log4j-over-slf4j-1.6.1" type="jar" ext="jar" conf="log4j-bridge"/>

ivy metadata of logging#logback;0.9.24 ivy: 
<ivy-module version="2.0">
    <info organisation="logging" module="logback" revision="0.9.24">
       <description>Back end logging implementation that implements SLF4J (successor
to Log4J).</description>
       <conf name="runtime" description="Core runtime dependencies"/>
       <artifact name="logback-core-0.9.24" type="jar" ext="jar" conf="runtime"/>
       <artifact name="logback-classic-0.9.24" type="jar" ext="jar" conf="runtime"/>
       <dependency org="logging" name="slf4j" rev="1.6.1" conf="runtime->bridges"/>

Dependencies to resolve:
<dependency org="logging" name="slf4j" rev="[1.6.1, 1.6.2]" conf="runtime"/>
<dependency org="logging" name="logback" rev="[0.9.24, 0.9.25]" conf="build-tests->runtime"

I would expect the following jars of slf4j are resolved:
slf4-api-1.6.1.jar, jcl-over-slf4j-1.6.1.jar, jul-to-slf4j-1.6.1.jar, log4j-over-slf4j-1.6.1.jar
However, only slf4j-api-1.6.1.jar is resolved.

A eclipse project is attached to demonstrate the issue.
ivy metadata for slf4j 1.6.1: repo\logging\slf4j\1.6.1\ivy.xml)
ivy metadata for logback 0.9.24: repo\logging\logback\0.9.24\ivy.xml

I've debugged through and found that VisitNode does not deal with dynamic version correctly,
so that when slf4j contains extra attributes, it behaves incorrectly:
org.apache.ivy.core.resolve.VisitNode: line 286 - 302
public boolean loadData(String conf, boolean shouldBePublic) {
    boolean loaded = node.loadData(
    rootModuleConf, getParentNode(), parentConf, conf, shouldBePublic, getUsage());
    if (loaded) {
        // if the loaded revision is different from original one
        // we now register this node on the new resolved id
        // this includes two cases:
        // - the id refers to a dynamic revision, which has beenresolved by loadData
        // - the loaded module descriptor has extra attributes in his info tag which are not
        //   used when declaring the dependency
        if (data.getNode(node.getResolvedId()) == null || !data.getNode(node.getResolvedId()).getId().equals(node.getResolvedId()))
               data.register(node.getResolvedId(), this);
               /** If node's id is dynamic, e.g. logging#slf4j;[1.6.1, 1.6.2], then the VisitNode
will not be associated with it because only resolvedId is considered here*/
               /** The following fix associates dynamic id with VisitData as well */
               /** FIX START **/
               if(!node.getResolvedId().equals(node.getId())) {
                   ModuleRevisionId resolvedId = node.getResolvedId();
resolvedId.getName(),  resolvedId.getBranch(), resolvedId.getRevision()), this);
               /** FIX END **/

    return loaded;

I've applied this fix to handle dynamic version and then the resolution works fine.


This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message