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

incorrect child dependency selected when parent is not selected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.8
    • 2.0.9
    • None

    Description

      I'm writing unit tests to reproduce MNG-2123 and I found a separate issue. I did the following
      a 1.0 >b 1.0>c3.2->d1.1
      a 1.0 >e1.0>c[1.0,3.0]->d1.0

      The available versions are c2.5,c3.2,d1.0,d1.1

      The resulting list is including d1.1 not 1.0

      d1.1 comes from the c3.2 which is not included, c2.5 was and thus d1.0 should have been.

          public void testCompatibleRecommendedVersionWithChildren()
              throws ArtifactResolutionException, InvalidVersionSpecificationException
          {
      
              // this test puts two dependencies on C with 3.2 and [1.0,3.0] as the version.
              // it puts 2.5 in the pretend repo...we should get back 2.5
              ArtifactSpec a = createArtifactSpec( "a", "1.0" );
              ArtifactSpec b = a.addDependency( "b", "1.0" );
              ArtifactSpec e = a.addDependency( "e", "1.0" );
              ArtifactSpec c1 = b.addDependency( "c", "3.2" );
              ArtifactSpec d1 = c1.addDependency( "d","1.1" );
              e.addDependency( "c", "[1.0,3.0]" );
      
              // put it in the repo
              ArtifactSpec c = createArtifactSpec( "c", "2.5" );
              ArtifactSpec d = c.addDependency( "d","1.0" );
              
              source.addArtifact( c );
              source.addArtifact( d );
              source.addArtifact( c1 );
              source.addArtifact( d1 );
      
              ArtifactResolutionResult res = collect( a );
      
              assertEquals( "Check artifact list",
                            createSet( new Object[] { a.artifact, b.artifact, e.artifact, c.artifact,d.artifact } ), res.getArtifacts() );
              assertEquals( "Check version", "2.5", getArtifact( "c", res.getArtifacts() ).getVersion() );
          }
      

      Attachments

        Activity

          People

            brianf Brian E Fox
            brianf Brian E Fox
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: