Uploaded image for project: 'Maven Shared Components'
  1. Maven Shared Components
  2. MSHARED-88

ProjectTransitivityFilter has incorrect behavior for artifactIsADirectDependency method

    XMLWordPrintableJSON

Details

    Description

      In the class org.apache.maven.shared.artifact.filter.collection.ProjectTransitivityFilter, the filter should only include items that are part of the direct dependencies. However, the method that does this check (artifactIsADirectDependency) only verifies that a dependency has the same artifactId and groupId as a direct dependency. It should also check the classifier and type. I've included an updated version of the method below:

      public boolean artifactIsADirectDependency( Artifact artifact )
      {
          boolean result = false;
          Iterator iterator = this.directDependencies.iterator();
          while ( iterator.hasNext() )
          {
              Artifact dependency = (Artifact) iterator.next();
              if ( dependency.getGroupId().equals( artifact.getGroupId() ) &&
                  dependency.getArtifactId().equals( artifact.getArtifactId() ) &&
                  dependency.getClassifier().equals( artifact.getClassifier() ) &&
                  dependency.getType().equals( artifact.getType() ) )
              {
                  result = true;
                  break;
              }
          }
          return result;
      }
      

      Attachments

        Activity

          People

            aheritier Arnaud Heritier
            owenkellett Owen Kellett
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: