Maven Assembly Plugin
  1. Maven Assembly Plugin
  2. MASSEMBLY-180

A bug in artifact filtering ( maven-common-artifact-filters )

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.2-beta-2
    • Component/s: None
    • Labels:
      None

      Description

      I found this bug while using <includes> and <excludes> section in <dependencySet> element.
      I had to check the source code to understand the "Advanced Artifact-Matching in includes and excludes".
      I found a bug in the project maven-common-artifact-filters, 1.0-alpha-1.
      I checked the class PatternIncludesArtifactFilter, revision 487820.
      There is a bug in the method:
      private boolean matchAgainst( String value, List patterns, boolean regionMatch )
      There is an iteration of a list of patterns. When a pattern matches, the method should return true.
      When no pattern matches, it should return false.
      However, when there is a pattern using a wildcard and this pattern does not match, the flow
      will reach the line 216 where the method returns false.
      Gotcha! the next patterns are not tried....
      In other words, say we have :
      <dependencySet>
      ...
      <exclusions>
      <exclusion>:jar:</exclusion>
      </exclusion>:test-jar:</exclusion>
      </exclusions>
      ...
      </dependencySet>
      The effect of the bug is that the seconds pattern (:test-jar will not be used, because if matching of the first (:jar fails,
      the method returns false, the next patterns is not used.
      I hope I clarified this issue.

        Activity

        Milos Volauf created issue -
        John Casey made changes -
        Field Original Value New Value
        Assignee John Casey [ jdcasey ]
        Description I found this bug while using <includes> and <excludes> section in <dependencySet> element.
        I had to check the source code to understand the "Advanced Artifact-Matching in includes and excludes".

        I found a bug in the project maven-common-artifact-filters, 1.0-alpha-1.
        I checked the class PatternIncludesArtifactFilter, revision 487820.

        There is a bug in the method:
        private boolean matchAgainst( String value, List patterns, boolean regionMatch )

        There is an iteration of a list of patterns. When a pattern matches, the method should return true.
        When no pattern matches, it should return false.

        However, when there is a pattern using a wildcard (*) and this pattern does not match, the flow
        will reach the line 216 where the method returns false.
        Gotcha! the next patterns are not tried....

        In other words, say we have :
        <dependencySet>
        ...
        <exclusions>
        <exclusion>*:jar:*</exclusion>
        </exclusion>*:test-jar:*</exclusion>
        </exclusions>
        ...
        </dependencySet>

        The effect of the bug is that the seconds pattern (*:test-jar:*) will not be used, because if matching of the first (*:jar:*) fails,
        the method returns false, the next patterns is not used.

        I hope I clarified this issue.
        I found this bug while using <includes> and <excludes> section in <dependencySet> element.
        I had to check the source code to understand the "Advanced Artifact-Matching in includes and excludes".
        I found a bug in the project maven-common-artifact-filters, 1.0-alpha-1.
        I checked the class PatternIncludesArtifactFilter, revision 487820.
        There is a bug in the method:
        private boolean matchAgainst( String value, List patterns, boolean regionMatch )
        There is an iteration of a list of patterns. When a pattern matches, the method should return true.
        When no pattern matches, it should return false.
        However, when there is a pattern using a wildcard and this pattern does not match, the flow
        will reach the line 216 where the method returns false.
        Gotcha! the next patterns are not tried....
        In other words, say we have :
        <dependencySet>
        ...
        <exclusions>
        <exclusion>:jar:</exclusion>
        </exclusion>:test-jar:</exclusion>
        </exclusions>
        ...
        </dependencySet>
        The effect of the bug is that the seconds pattern (:test-jar:) will not be used, because if matching of the first (:jar:) fails,
        the method returns false, the next patterns is not used.
        I hope I clarified this issue.
        John Casey made changes -
        Fix Version/s 2.2 [ 12617 ]
        John Casey made changes -
        Fix Version/s 2.2 [ 12617 ]
        Fix Version/s 2.2-beta-2 [ 13507 ]
        John Casey made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        John Casey made changes -
        Fix Version/s 2.2-beta-3 [ 13507 ]
        Fix Version/s 2.2-beta-2 [ 14027 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 09:09:00 UTC 2015 [ 1428224940639 ]
        Mark Thomas made changes -
        Workflow jira [ 12717134 ] Default workflow, editable Closed status [ 12760909 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 22:33:31 UTC 2015 [ 1428273211083 ]
        Mark Thomas made changes -
        Workflow jira [ 12955032 ] Default workflow, editable Closed status [ 12992177 ]

          People

          • Assignee:
            John Casey
            Reporter:
            Milos Volauf
          • Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development