[ https://issues.apache.org/jira/browse/MSHADE-317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17261103#comment-17261103 ]
Frantisek Hartman commented on MSHADE-317: ------------------------------------------ I came across exactly the same issue. This happens when Module 1 shades a library & relocates it, e.g. com.google to org.example.com.google, the sources get relocated correctly. {quote}<relocation> <pattern>com.google</pattern> <shadedPattern>org.example.com.google</shadedPattern> </relocation> {quote} Module 2 depends on Module 1, also uses the library & relocates it, you end up with overlapping resources which you can exclude somehow (set library in module 2 as provided, add it to exclusions, doesn't matter). The classfiles are correct, but the sources of Module1 get relocated again incorrectly: E.g: import org.example.*com.google*.common.collect.Lists.newArrayList; The highlighted pattern is matched and replaced with shaded pattern ending up with the repetition of the shaded pattern prefix. import *org.example.org.example*.com.google.common.collect.Lists.newArrayList; See the project attached. I tracked down the problem to SimpleRelocator: {quote}{color:#000080}return {color}sourceContent.replaceAll( {color:#008000}"{color}{color:#000080}\\{color}{color:#008000}b" {color}+ {color:#660e7a}pattern{color}, {color:#660e7a}shadedPattern {color}); {quote} The dot in the package is unfortunately a word boundary.[^shade-issue-MSHADE-317.zip] https://github.com/apache/maven-shade-plugin/blob/master/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java#L219 > Source package name parse error > ------------------------------- > > Key: MSHADE-317 > URL: https://issues.apache.org/jira/browse/MSHADE-317 > Project: Maven Shade Plugin > Issue Type: Bug > Affects Versions: 3.2.1 > Reporter: xuzhiyi > Priority: Major > Attachments: image-2019-04-13-17-58-43-081.png, > shade-issue-MSHADE-317.zip > > > {code:java} > If shadedPattern full contains pattern, package name gos wrong. Such as:{code} > {code:java} > //代码占位符 > <relocations> > <relocation> > <pattern>org.objectweb.asm</pattern> > <shadedPattern>com.alibaba.arthas.deps.org.objectweb.asm</shadedPattern> > </relocation> > </relocations> > {code} > !image-2019-04-13-17-58-43-081.png! -- This message was sent by Atlassian Jira (v8.3.4#803005)