[ 
https://issues.apache.org/jira/browse/MSHADE-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17115541#comment-17115541
 ] 

Pavel Bekkerman edited comment on MSHADE-291 at 5/24/20, 10:21 PM:
-------------------------------------------------------------------

# I already figured out the reason for META-INF/spring.handlers to appear 
during the debug: when inheriting from spring-boot-starter-parent, some 
defaults are configured for maven-shade-plugin. To avoid this one can use 
{code:java}
combine.self="override"
{code}
For example 
{code:java}
<transformers combine.self="override"><transformers combine.self="override"> 
<transformer 
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"
 /> </transformers>
{code}

 # As for the original issue (shaded pattern multiplication) The offending line 
seems to be org.apache.maven.plugins.shade.relocation.SimpleRelocator:219 

{code:java}
            return sourceContent.replaceAll( "\\b" + pattern, shadedPattern );
{code}
 
 When pattern is null or empty (which is possible according to the 
documentation, and effectively allows to relocate ALL the packages) - it goes 
nuts.


was (Author: wheredevel):
# I already figured out the reason for META-INF/spring.handlers to appear 
during the debug: when inheriting from spring-boot-starter-parent, some 
defaults are configured for maven-shade-plugin. To avoid this one can use 
{code:java}
combine.self="override"
{code}
For example 
{code:java}
<transformers combine.self="override"><transformers combine.self="override"> 
<transformer 
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"
 /> </transformers>
{code}

 # As for the original issue (shaded pattern multiplication) The offending line 
seems to be org.apache.maven.plugins.shade.relocation.SimpleRelocator:219 

{code:java}
            return sourceContent.replaceAll( "\\b" + pattern, shadedPattern );
{code}
 
 When pattern is null or empty (which is possible according to the 
documentation, and effectively allows to relocate ALL the packages) - it goes 
nuts.

> shadedPattern applied multiples times when relocating the contents of 
> META-INF/services files
> ---------------------------------------------------------------------------------------------
>
>                 Key: MSHADE-291
>                 URL: https://issues.apache.org/jira/browse/MSHADE-291
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 3.1.1, 3.2.0, 3.2.1
>            Reporter: Jan Luehe
>            Assignee: Robert Scholte
>            Priority: Major
>              Labels: up-for-grabs
>             Fix For: 3.2.2
>
>
> Steps to reproduce:
> 1. Modified the test case for 
> https://issues.apache.org/jira/browse/MSHADE-190, as follows:
> {code:java}
> diff --git a/pom.xml b/pom.xml
> index 746b700..aea9abb 100644
> --- a/pom.xml
> +++ b/pom.xml
> @@ -68,12 +68,12 @@
>              <plugin>
>                  <groupId>org.apache.maven.plugins</groupId>
>                  <artifactId>maven-shade-plugin</artifactId>
> -                <version>2.4</version>
> +                <version>3.1.1</version>
>                  <configuration>
>                      <relocations>
>                          <relocation>
> -                            <pattern>org.eclipse.*</pattern>
> -                            <shadedPattern>borg.eclipse.*</shadedPattern>
> +                            <pattern>org.eclipse</pattern>
> +                            <shadedPattern>org.eclipse1234</shadedPattern>
>                          </relocation>
>                      </relocations>
>                      <transformers>
> {code}
> 2. mvn package
> 3. jar -xvf target/shade-meta-tc-1.0-SNAPSHOT.jar META-INF/services
> 4. cat META-INF/services/org.osgi.framework.launch.FrameworkFactory
> The shaded service implementation class looks as follows: 
> {code:java}
> org.eclipse12341234.osgi.launch.EquinoxFactory
> {code}
> It appears that shadedPattern was applied twice.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to