[ 
https://issues.apache.org/jira/browse/IVY-929?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641074#action_12641074
 ] 

Scott Hebert commented on IVY-929:
----------------------------------

Hi,

The problem seems to be here:

{code}
    private ModuleRevisionId getRevision(ResolvedResource ivyRef, 
ModuleRevisionId askedMrid,
            ModuleDescriptor md) throws ParseException {
        String revision = ivyRef.getRevision();
        if (revision == null) {
            Message.debug("no revision found in reference for " + askedMrid);
            if (getSettings().getVersionMatcher().isDynamic(askedMrid)) {
                if (md.getModuleRevisionId().getRevision() == null) {
                    return ModuleRevisionId.newInstance(askedMrid, "working@" + 
getName());
                } else {
                    Message.debug("using  " + askedMrid);
                    return askedMrid;
                }
            } else {
                Message.debug("using  " + askedMrid);
                return askedMrid;
            }
        } else {
            //return ModuleRevisionId.newInstance(askedMrid, revision);
            return ModuleRevisionId.newInstance(askedMrid.getOrganisation(), 
askedMrid.getName(), askedMrid.getBranch(), revision, md.getExtraAttributes());
        }
    }
{code} 

With this being the fix:

{code}
            //return ModuleRevisionId.newInstance(askedMrid, revision);
            return ModuleRevisionId.newInstance(askedMrid.getOrganisation(), 
askedMrid.getName(), askedMrid.getBranch(), revision, md.getExtraAttributes());
{code}

Essentially, this method was returning a ModuleRevisionId which did not have 
any ExtraAttributes. Later this "revision" was being used to set the 
ModuleRevisionId of *defaultMd* which would in turn set it for *systemMd*.

{code}
                            ModuleRevisionId revision = getRevision(ivyRef, 
systemMrid, systemMd);
                            defaultMd.setModuleRevisionId(revision);
                            defaultMd.setResolvedModuleRevisionId(revision);
{code}

*systemMd* was then being used here:

{code}
                    rmr = new ResolvedModuleRevision(
                        this, this, systemMd, toSystem(rmr.getReport()), 
isForce());
{code}

and *rmr* was being used as the return ResolvedModuleRevision.


> Extra Attributes specified in the Dependency's Module Descriptor are not 
> available to resolvers
> -----------------------------------------------------------------------------------------------
>
>                 Key: IVY-929
>                 URL: https://issues.apache.org/jira/browse/IVY-929
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0-RC1
>         Environment: Windows
> Java 6
>            Reporter: Scott Hebert
>            Priority: Critical
>
> {quote}This is a follow up to IVY-773{quote}
> Consider the following IVY file:
> {code:xml}<ivy-module version="1.0">
>     <info organisation="apache" module="extra-att" revision="1.0"/>
>     <dependencies>
>               <dependency name="mymodule" rev="1748" />
>     </dependencies>
> </ivy-module>
> {code}
> and the corresponding dependency's IVY file:
> {code:xml}
> <ivy-module version="1.0">
>     <info 
>         organisation="apache"
>         module="mymodule"
>         myextraattrib="abc123"
>         revision="1748"
>         status="integration"/>
>       <publications>
>               <artifact name="mymodule" platform="windows" type="jar"/>
>               <artifact name="mymodule" platform="linux" type="jar"/>
>       </publications>
> </ivy-module>
> {code}
> When a resolver resolves to determine the revision of dependency, it seems 
> that the extra attribute *myextraattrib* is not available.
> I've narrowed it down to the method in *BasicResolver*:
> {code:java}
>     public ResolvedModuleRevision getDependency(DependencyDescriptor dd, 
> ResolveData data) {}
> {code}
> where at this point:
> {code:java}
>   rmr = parse(ivyRef, systemDd, data);
> {code}
> *rmr* contains the extra attributes... but at this point:
> {code:xml}
>                         if (systemMd instanceof DefaultModuleDescriptor) {
>                             DefaultModuleDescriptor defaultMd = 
> (DefaultModuleDescriptor) systemMd;
>                             ModuleRevisionId revision = getRevision(ivyRef, 
> systemMrid, systemMd);
>                             defaultMd.setModuleRevisionId(revision);
>                             defaultMd.setResolvedModuleRevisionId(revision);
> {code}
> {code:xml}
>                             ModuleRevisionId revision = getRevision(ivyRef, 
> systemMrid, systemMd);
> {code}
> *revision* is missing the extra attributes.
> I am not familiar enough with the meanings of each of the objects to be able 
> to fix this.
> Thanks
> Scott

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

Reply via email to