On 16. 11. 21 17:36, Slawomir Jaranowski wrote:
> Hi,
> Thanks for reporting.
> 
> Does your issue is similar to [1] - If yes please comment, vote
> or if it is something else you can create a new issue.

I have created a new issue. In my case, Assembly plugin 2.5.5 works and
3.0.0+ breaks. New issue:
https://issues.apache.org/jira/browse/MASSEMBLY-955

> 
> [1] https://issues.apache.org/jira/browse/MASSEMBLY-607
> 
> 
> wt., 16 lis 2021 o 14:51 Václav Haisman <vhais...@gmail.com> napisał(a):
> 
>> 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
>>
>>    - <include>com.XYZ:some-artifact:*:service:*</include>
>>    - <include>org.python:jython-standalone</include>
>>
>> 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*:
>>
>> 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;
>>             }
>>
>> 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.
>>
>> // 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] };
>> }
>>
>>
>> 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?
>>
>>
>> --
>> VH
>>
> 
> 


-- 
VH

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to