Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-3380

MavenMetadataSource retrieves ResolutionGroup without consulting ManagedVersionMap, is problem when relocation

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.8
    • Fix Version/s: 2.0.10, 2.1.0-M1
    • Component/s: Dependencies
    • Labels:
      None
    • Flags:
      Patch

      Description

      Consider the following scenario:

      <project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>root-groupId</groupId>
        <artifactId>root-artifactId</artifactId>
        <version>1</version>
        <dependencies>
          <dependency>
            <groupId>direct-dependency-groupId</groupId>
            <artifactId>direct-dependency-artifactId</artifactId>
            <version>1</version>
          </dependency>
        </dependencies>
        <dependencyManagement>
          <dependencies>
            <dependency>
              <groupId>transitive-dependency-new-groupId</groupId>
              <artifactId>transitive-dependency-artifactId</artifactId>
              <version>2</version>
            </dependency>
          </dependencies>
        </dependencyManagement>
      </project>
      
      <project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>direct-dependency-groupId</groupId>
        <artifactId>direct-dependency-artifactId</artifactId>
        <version>1</version>
        <dependencies>
          <dependency>
            <groupId>transitive-dependency-old-groupId</groupId>
            <artifactId>transitive-dependency-artifactId</artifactId>
            <version>1</version>
          </dependency>
        </dependencies>
      </project>       
      
             
      <project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>transitive-dependency-old-groupId</groupId>
        <artifactId>transitive-dependency-artifactId</artifactId>
        <version>1</version>
        <distributionManagement>
          <relocation>
            <groupId>transitive-dependency-new-groupId</groupId>
          </relocation>
        </distributionManagement>
      </project>       
      
      <project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>transitive-dependency-new-groupId</groupId>
        <artifactId>transitive-dependency-artifactId</artifactId>
        <version>1</version>
        <dependencies>
          <dependency>
            <groupId>other-groupId</groupId>
            <artifactId>other-artifactId-a</artifactId>
            <version>1</version>
          </dependency>
        </dependencies>
      </project>
      
      <project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>transitive-dependency-new-groupId</groupId>
        <artifactId>transitive-dependency-artifactId</artifactId>
        <version>2</version>
        <dependencies>
          <dependency>
            <groupId>other-groupId</groupId>
            <artifactId>other-artifactId-a</artifactId>
            <version>1</version>
          </dependency>
          <dependency>
            <groupId>other-groupId</groupId>
            <artifactId>other-artifactId-b</artifactId>
            <version>1</version>
          </dependency>
        </dependencies>
      </project>
      
      --------------------------------------------------------------        
      actual dependency:tree 
          
       root-groupId:root-artifactId:jar:1
       \- direct-dependency-groupId:direct-dependency-artifactId:jar:1:compile
          \- transitive-dependency-new-groupId:transitive-dependency-artifactId:jar:2:compile (version managed from 1)
             \- other-groupId:other-artifactId-a:jar:1:compile           
      -------------------------------------------------------------- 
      expected dependency:tree 
          
       root-groupId:root-artifactId:jar:1
       \- direct-dependency-groupId:direct-dependency-artifactId:jar:1:compile
          \- transitive-dependency-new-groupId:transitive-dependency-artifactId:jar:2:compile (version managed from 1)
             \- other-groupId:other-artifactId-a:jar:1:compile    
             \- other-groupId:other-artifactId-b:jar:1:compile <-- missing from actual result    
      -------------------------------------------------------------- 
      

      As you can see from the listing above, other-groupId:other-artifactId-b:jar:1:compile is missing from the dependency list.

      I have attached the zipped repo which was used when generating the dependency:tree listings shown above. I also attached a crude temporary patch which my team is currently using to resolve this issue. After ignoring whitespace changes, it is about 10 lines different.

      Thanks,

      Luke

        Attachments

        1. repo.zip
          13 kB
          luke w patterson
        2. patch.txt
          11 kB
          luke w patterson
        3. MNG-3380-maven-artifact.patch
          11 kB
          luke w patterson
        4. MNG-3380-integration-test.zip
          22 kB
          luke w patterson

          Activity

            People

            • Assignee:
              jdcasey John Casey
              Reporter:
              lukewpatterson luke w patterson
            • Votes:
              7 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: