[ 
https://issues.apache.org/jira/browse/IVY-1127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Antoine Levy-Lambert resolved IVY-1127.
---------------------------------------

    Resolution: Invalid

I found out that the branch is found out from settings which are themselves 
found in a static class IvyContext ...

this is in ModuleRevisionId.java :

        this.branch = (replaceNullBranchWithDefault && branch == null) 
            // we test if there's already an Ivy instance loaded, to avoid 
loading a default one 
            // just to get the default branch
            ? (context.peekIvy() == null ? null : 
context.getSettings().getDefaultBranch(moduleId)) 
            : branch;

So adding these lines after the creation of my "IvySettings" fixed the issue :

                // these lines allow the settings, including the branch, to be 
found
        IvyContext.pushNewCopyContext();
        IvyContext.getContext().setIvy(ivy);




> branch field of dependencies is null after doing programmatic parsing of a 
> module descriptor
> --------------------------------------------------------------------------------------------
>
>                 Key: IVY-1127
>                 URL: https://issues.apache.org/jira/browse/IVY-1127
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1.0-RC2
>         Environment: Win 32/Java 1.5
>            Reporter: Antoine Levy-Lambert
>
>               ModuleDescriptorParserRegistry mdpr = 
> ModuleDescriptorParserRegistry
>                               .getInstance();
>               ModuleDescriptor md = mdpr.parseDescriptor(ivy.getSettings(), 
> ivyFile
>                               .toURL(), true);
>                DependencyDescriptor[] dependencies = md.getDependencies();
>                for (int i = 0; i < dependencies.length; i++) {
>                               DependencyDescriptor dependency = 
> dependencies[i];
>                               ModuleRevisionId depMrid = 
> dependency.getDependencyRevisionId();
>                               if (depMrid.getRevision().startsWith("latest")) 
> {
>               
>                                       String depModule = depMrid.getName();
>                                       String depOrganisation = 
> depMrid.getOrganisation();
>                                       String depRevision = 
> depMrid.getRevision();
>                                         // I am getting null here
>                                       String depBranch = depMrid.getBranch();
>                                }
>                }
> Any idea what is going on here ? It looks a bit similar to IVY-1087
> Regards,
> Antoine

-- 
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