Uploaded image for project: 'Maven Dependency Plugin'
  1. Maven Dependency Plugin
  2. MDEP-501

Filtering dependencies does not retain the order of the unfiltered list

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.10
    • 3.0.1
    • None
    • None

    Description

      If you use the build-classpath mojo, you get the dependency list as specified in the pom. However, if you introduce filtering, you end up losing the dependency order. It seems that the org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter declares 'Set' instead of 'SortedSet' and that the org.apache.maven.shared.artifact.filter.collection.AbstractArtifactFeatureFilter returns a HashSet instead of a LinkedHashSet, even though a LinkedHashSet is being passed in.

      The impact of this is that you cannot generate a correctly-ordered classpath when using filters. The fix is very straightforward, simply change the filterIncludes and filterExcludes methods of AbstractArtifactFeatureFilter to use a LinkedHashSet.

      Attachments

        1. build-classpath-preserve-order.patch
          19 kB
          Erling Johan Andersen

        Issue Links

          Activity

            People

              michael-o Michael Osipov
              beirtipol@gmail.com Beirtí Ó'Nunáin
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: