[
https://issues.apache.org/jira/browse/MASSEMBLY-955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17553115#comment-17553115
]
Tamás Cservenák edited comment on MASSEMBLY-955 at 6/11/22 2:16 PM:
--------------------------------------------------------------------
Fix is updating maven-common-artifact-filters to 3.3.0 as done in
https://github.com/apache/maven-assembly-plugin/pull/68
was (Author: cstamas):
Fix is updating maven-common-artifact-filters to 3.3.0
> dependencySet includes filter with classifier breaks include of artifacts
> without classifier
> --------------------------------------------------------------------------------------------
>
> Key: MASSEMBLY-955
> URL: https://issues.apache.org/jira/browse/MASSEMBLY-955
> Project: Maven Assembly Plugin
> Issue Type: Bug
> Components: dependencySet, filtering
> Affects Versions: 3.0.0, 3.1.0, 3.1.1, 3.2.0, 3.3.0
> Reporter: Václav Haisman
> Assignee: Tamás Cservenák
> Priority: Major
> Labels: pull-request-available
> Fix For: 3.4.0
>
>
> I have created a demonstration repo for this issue at
> [https://github.com/wilx/maven-assembly-includes-test-case]. As demonstrated
> by the test projects in the repository, the filtering breaks with version
> 3.0.0 of Maven Assembly plugin but at least it finishes building something.
> If I try to update maven-common-artifact-filters to 3.2.0, it breaks the
> build completely because it does not like 5 components include pattern.
> Following is cut&paste of my email to dev mailing list:
> Hi.
> I think I found a defect in the latest currently available Maven Assembly
> plugin version 3.3.0. The Assembly plugin uses Common Artifact Filters's
> class `PatternIncludesArtifactFilter`. This class, in its method
> `matchAgainst()` loops over include patterns. If one of the include patterns
> contains 4+ components, 4th being the classifier (according to the source
> code, documentation does not mention classifier), it immediately rejects the
> artifact being checked for inclusion without testing the other patterns. My
> inclusion patterns are
> {code:java}
> <include>com.XYZ:some-artifact:*:service:*</include>
> <include>org.python:jython-standalone</include>
> {code}
> The jython pattern is not even tested against the jython dependency because
> it returns from the function early instead of continuing the loop. This is
> code, the return statement should be continue statement instead for this to
> work as I think was intended:
> {code:java}
> private boolean matchAgainst( final String value, final List<String>
> patterns, final boolean regionMatch )
> {
> final String[] tokens = value.split( ":" );
> for ( String pattern : patterns )
> {
> String[] patternTokens = pattern.split( ":" );
>
> if ( patternTokens.length == 5 && tokens.length < 5 )
> {
> // 4th element is the classifier
> if ( !"*".equals( patternTokens[3] ) )
> {
> // classifier required, cannot be a match
> return false;
> }
> {code}
> But this is not all. I tried running the 3.3.0 Assembly plugin with
> maven-common-artifact-filters artifact version 3.2.0 which seems to have been
> significantly rewritten. However, that rejects my 5 components pattern
> entirely. The comment in the code says "we only accept 5 tokens if the
> classifier = '*'", which seems to be a departure from what the previous
> version tried to support.
> {code:java}
> // we only accept 5 tokens if the classifier = '*'
> if ( tokens.length == 5 )
> {
> if ( tokens[3] != ANY )
> {
> throw new IllegalArgumentException( "Invalid pattern: " + pattern );
> }
> tokens = new char[][] { tokens[0], tokens[1], tokens[2], tokens[4] };
> }
> {code}
> Was it intentional that the rewrite of the artifact filters stopped
> supporting previously supported patterns?
> Can we release Common Artifact Filters version 3.1.1 or such with the return
> statement changed to continue statement and at the same time release Assembly
> plugin 3.3.1 which would use this fixed Common Artifact Filters version to
> unbreak this?
> Can we fix the Common Artifact Filters version 3.2.0 to accept the inclusion
> filter with the classifier as do the previous versions?
>
--
This message was sent by Atlassian Jira
(v8.20.7#820007)