Skip to content

Commit cf24c1a

Browse files
kriegaexhboutemy
authored andcommitted
[MSHADE-252] Make relocation ex-/include matching more lenient, accepting '.**' too
Actually, class patterns are supposed to should just use 'foo.bar.*' ending with a single asterisk, but some users mistake them for path patterns like 'my/path/**', so let us be a bit more lenient here. See also my related comment in MSHADE-252: https://issues.apache.org/jira/browse/MSHADE-252?focusedCommentId=17314393&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17314393
1 parent 02fba3a commit cf24c1a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,13 @@ private static Set<String> normalizePatterns( Collection<String> patterns )
114114
if ( patterns != null && !patterns.isEmpty() )
115115
{
116116
normalized = new LinkedHashSet<>();
117-
118117
for ( String pattern : patterns )
119118
{
120-
121119
String classPattern = pattern.replace( '.', '/' );
122-
123120
normalized.add( classPattern );
124-
125-
if ( classPattern.endsWith( "/*" ) )
121+
// Actually, class patterns should just use 'foo.bar.*' ending with a single asterisk, but some users
122+
// mistake them for path patterns like 'my/path/**', so let us be a bit more lenient here.
123+
if ( classPattern.endsWith( "/*" ) || classPattern.endsWith( "/**" ) )
126124
{
127125
String packagePattern = classPattern.substring( 0, classPattern.lastIndexOf( '/' ) );
128126
normalized.add( packagePattern );

0 commit comments

Comments
 (0)