[jira] [Updated] (MSHADE-452) Shade plugin can't replace SPI content correct when pattern not end with dot

2023-07-20 Thread hk__lrzy (Jira)


 [ 
https://issues.apache.org/jira/browse/MSHADE-452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

hk__lrzy updated MSHADE-452:

Summary: Shade plugin can't replace SPI content correct when pattern not 
end with dot  (was: Shade plugin can't replace SPI content with correct)

> Shade plugin can't replace SPI content correct when pattern not end with dot
> 
>
> Key: MSHADE-452
> URL: https://issues.apache.org/jira/browse/MSHADE-452
> Project: Maven Shade Plugin
>  Issue Type: Improvement
>Affects Versions: 3.5.0
>Reporter: hk__lrzy
>Priority: Critical
> Attachments: 20230720-205856.png, 20230720-205900.png
>
>
> We have java path as below
> _*org.apache.demo1*_
> _*org.apache.demo2*_
> In {_}*maven-shade-plugin 3.2.1*{_}, we use relocation to process path and 
> SPI Service file at the same time, and we will follow result.
> {code:java}
> 
> org.apache.demo
> shaded.org.apache.demo
>  {code}
> {code:java}
> META-INF/services/shaded.org.apache.demo{code}
> But in _*maven-shaded-plugin 3.5.0,*_ it can't work as before, alouthght it 
> SPI file name alao could be changed, but the SPI file content will {_}*have 
> no change*{_}.
> I see the differneces between the _*maven-shaded-plugin 3.5.0 and 
> maven-shaded-plugin 3.2.1,*_ finally find in _*maven-shaded-plugin 3.2.1,*_ 
> file content changed by follow code
>  
> {code:java}
> public String applyToSourceContent( String sourceContent )
> {
> if ( rawString )
> {
> return sourceContent;
> }
> else
> {
> return sourceContent.replaceAll( "\\b" + pattern, shadedPattern );
> }
> }{code}
> but in {_}*maven-shaded-plugin 3.5.0*{_}, _**_ the code change to 
> {code:java}
> private String shadeSourceWithExcludes( String sourceContent, String 
> patternFrom, String patternTo,
> Set excludedPatterns )
> {
> // Usually shading makes package names a bit longer, so make buffer 10% 
> bigger than original source
> StringBuilder shadedSourceContent = new StringBuilder( 
> sourceContent.length() * 11 / 10 );
> boolean isFirstSnippet = true;
> // Make sure that search pattern starts at word boundary and we look for 
> literal ".", not regex jokers
> for ( String snippet : sourceContent.split( "\\b" + patternFrom.replace( 
> ".", "[.]" + "\\b" ) ) )
> {
> boolean doExclude = false;
> for ( String excludedPattern : excludedPatterns )
> {
> if ( snippet.startsWith( excludedPattern ) )
> {
> doExclude = true;
> break;
> }
> }
> if ( isFirstSnippet )
> {
> shadedSourceContent.append( snippet );
> isFirstSnippet = false;
> }
> else
> {
> shadedSourceContent.append( doExclude ? patternFrom : patternTo 
> ).append( snippet );
> }
> }
> return shadedSourceContent.toString();
> } {code}
> In my cases, source content is {_}*org.apache.demo1*{_}, pattern from is 
> {_}*org.apache.demo*{_}, pattern to is _*shaded.org.apache.demo.*_
> and the code _*sourceContent.split( "\\b" + patternFrom.replace( ".", "[.]" + 
> "\\b" ) )*_ __ will only have one response.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (MSHADE-452) Shade plugin can't replace SPI content with correct

2023-07-20 Thread hk__lrzy (Jira)


 [ 
https://issues.apache.org/jira/browse/MSHADE-452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

hk__lrzy updated MSHADE-452:

Attachment: (was: image-2023-07-20-21-03-36-444.png)

> Shade plugin can't replace SPI content with correct
> ---
>
> Key: MSHADE-452
> URL: https://issues.apache.org/jira/browse/MSHADE-452
> Project: Maven Shade Plugin
>  Issue Type: Improvement
>Affects Versions: 3.5.0
>Reporter: hk__lrzy
>Priority: Critical
> Attachments: 20230720-205856.png, 20230720-205900.png
>
>
> We have java path as below
> _*org.apache.demo1*_
> _*org.apache.demo2*_
> In {_}*maven-shade-plugin 3.2.1*{_}, we use relocation to process path and 
> SPI Service file at the same time, and we will follow result.
> {code:java}
> 
> org.apache.demo
> shaded.org.apache.demo
>  {code}
> {code:java}
> META-INF/services/shaded.org.apache.demo{code}
> But in _*maven-shaded-plugin 3.5.0,*_ it can't work as before, alouthght it 
> SPI file name alao could be changed, but the SPI file content will {_}*have 
> no change*{_}.
> I see the differneces between the _*maven-shaded-plugin 3.5.0 and 
> maven-shaded-plugin 3.2.1,*_ finally find in _*maven-shaded-plugin 3.2.1,*_ 
> file content changed by follow code
>  
> {code:java}
> public String applyToSourceContent( String sourceContent )
> {
> if ( rawString )
> {
> return sourceContent;
> }
> else
> {
> return sourceContent.replaceAll( "\\b" + pattern, shadedPattern );
> }
> }{code}
> but in {_}*maven-shaded-plugin 3.5.0*{_}, _**_ the code change to 
> {code:java}
> private String shadeSourceWithExcludes( String sourceContent, String 
> patternFrom, String patternTo,
> Set excludedPatterns )
> {
> // Usually shading makes package names a bit longer, so make buffer 10% 
> bigger than original source
> StringBuilder shadedSourceContent = new StringBuilder( 
> sourceContent.length() * 11 / 10 );
> boolean isFirstSnippet = true;
> // Make sure that search pattern starts at word boundary and we look for 
> literal ".", not regex jokers
> for ( String snippet : sourceContent.split( "\\b" + patternFrom.replace( 
> ".", "[.]" + "\\b" ) ) )
> {
> boolean doExclude = false;
> for ( String excludedPattern : excludedPatterns )
> {
> if ( snippet.startsWith( excludedPattern ) )
> {
> doExclude = true;
> break;
> }
> }
> if ( isFirstSnippet )
> {
> shadedSourceContent.append( snippet );
> isFirstSnippet = false;
> }
> else
> {
> shadedSourceContent.append( doExclude ? patternFrom : patternTo 
> ).append( snippet );
> }
> }
> return shadedSourceContent.toString();
> } {code}
> In my cases, source content is {_}*org.apache.demo1*{_}, pattern from is 
> {_}*org.apache.demo*{_}, pattern to is _*shaded.org.apache.demo.*_
> and the code _*sourceContent.split( "\\b" + patternFrom.replace( ".", "[.]" + 
> "\\b" ) )*_ __ will only have one response.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (MSHADE-452) Shade plugin can't replace SPI content with correct

2023-07-20 Thread hk__lrzy (Jira)


 [ 
https://issues.apache.org/jira/browse/MSHADE-452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

hk__lrzy updated MSHADE-452:

Description: 
We have java path as below
_*org.apache.demo1*_

_*org.apache.demo2*_

In {_}*maven-shade-plugin 3.2.1*{_}, we use relocation to process path and SPI 
Service file at the same time, and we will follow result.
{code:java}

org.apache.demo
shaded.org.apache.demo
 {code}
{code:java}
META-INF/services/shaded.org.apache.demo{code}
But in _*maven-shaded-plugin 3.5.0,*_ it can't work as before, alouthght it SPI 
file name alao could be changed, but the SPI file content will {_}*have no 
change*{_}.

I see the differneces between the _*maven-shaded-plugin 3.5.0 and 
maven-shaded-plugin 3.2.1,*_ finally find in _*maven-shaded-plugin 3.2.1,*_ 
file content changed by follow code

 
{code:java}
public String applyToSourceContent( String sourceContent )
{
if ( rawString )
{
return sourceContent;
}
else
{
return sourceContent.replaceAll( "\\b" + pattern, shadedPattern );
}
}{code}
but in {_}*maven-shaded-plugin 3.5.0*{_}, _**_ the code change to 
{code:java}
private String shadeSourceWithExcludes( String sourceContent, String 
patternFrom, String patternTo,
Set excludedPatterns )
{
// Usually shading makes package names a bit longer, so make buffer 10% 
bigger than original source
StringBuilder shadedSourceContent = new StringBuilder( 
sourceContent.length() * 11 / 10 );
boolean isFirstSnippet = true;
// Make sure that search pattern starts at word boundary and we look for 
literal ".", not regex jokers
for ( String snippet : sourceContent.split( "\\b" + patternFrom.replace( 
".", "[.]" + "\\b" ) ) )
{
boolean doExclude = false;
for ( String excludedPattern : excludedPatterns )
{
if ( snippet.startsWith( excludedPattern ) )
{
doExclude = true;
break;
}
}
if ( isFirstSnippet )
{
shadedSourceContent.append( snippet );
isFirstSnippet = false;
}
else
{
shadedSourceContent.append( doExclude ? patternFrom : patternTo 
).append( snippet );
}
}
return shadedSourceContent.toString();
} {code}
In my cases, source content is {_}*org.apache.demo1*{_}, pattern from is 
{_}*org.apache.demo*{_}, pattern to is _*shaded.org.apache.demo.*_

and the code _*sourceContent.split( "\\b" + patternFrom.replace( ".", "[.]" + 
"\\b" ) )*_ __ will only have one response.

 

  was:
We have java path as below
_*org.apache.demo1*_

_*org.apache.demo2*_

In {_}*maven-shade-plugin 3.2.1*{_}, we use relocation to process path and SPI 
Service file at the same time, and we will follow result.
{code:java}

org.apache.demo
shaded.org.apache.demo
 {code}
{code:java}
META-INF/services/shaded.org.apache.demo{code}


> Shade plugin can't replace SPI content with correct
> ---
>
> Key: MSHADE-452
> URL: https://issues.apache.org/jira/browse/MSHADE-452
> Project: Maven Shade Plugin
>  Issue Type: Improvement
>Affects Versions: 3.5.0
>Reporter: hk__lrzy
>Priority: Critical
> Attachments: 20230720-205856.png, 20230720-205900.png, 
> image-2023-07-20-21-03-36-444.png
>
>
> We have java path as below
> _*org.apache.demo1*_
> _*org.apache.demo2*_
> In {_}*maven-shade-plugin 3.2.1*{_}, we use relocation to process path and 
> SPI Service file at the same time, and we will follow result.
> {code:java}
> 
> org.apache.demo
> shaded.org.apache.demo
>  {code}
> {code:java}
> META-INF/services/shaded.org.apache.demo{code}
> But in _*maven-shaded-plugin 3.5.0,*_ it can't work as before, alouthght it 
> SPI file name alao could be changed, but the SPI file content will {_}*have 
> no change*{_}.
> I see the differneces between the _*maven-shaded-plugin 3.5.0 and 
> maven-shaded-plugin 3.2.1,*_ finally find in _*maven-shaded-plugin 3.2.1,*_ 
> file content changed by follow code
>  
> {code:java}
> public String applyToSourceContent( String sourceContent )
> {
> if ( rawString )
> {
> return sourceContent;
> }
> else
> {
> return sourceContent.replaceAll( "\\b" + pattern, shadedPattern );
> }
> }{code}
> but in {_}*maven-shaded-plugin 3.5.0*{_}, _**_ the code change to 
> {code:java}
> private String shadeSourceWithExcludes( String sourceContent, String 
> patternFrom, String patternTo,
> Set excludedPatterns )
> {
> // Usually shading makes package names a bit longer, so make buffer 10% 
> bigger than original source
> StringBuilder shadedSourceContent = new StringBuilder( 
> sourceContent.length() * 11 / 10 );
> boolean isFirstSnippet = 

[jira] [Updated] (MSHADE-452) Shade plugin can't replace SPI content with correct

2023-07-20 Thread hk__lrzy (Jira)


 [ 
https://issues.apache.org/jira/browse/MSHADE-452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

hk__lrzy updated MSHADE-452:

Description: 
We have java path as below
_*org.apache.demo1*_

_*org.apache.demo2*_

In {_}*maven-shade-plugin 3.2.1*{_}, we use relocation to process path and SPI 
Service file at the same time, and we will follow result.
{code:java}

org.apache.demo
shaded.org.apache.demo
 {code}
{code:java}
META-INF/services/shaded.org.apache.demo{code}

  was:
We have java path like follow examples.
`org.apache.demo1`

`org.apache.demo2`

With maven shaded plugin 3.2.1 
we can use relocation
{code:java}

org.apache.demo
shaded.org.apache.demo
 {code}
to relocate java file and META-INF/services file both.
But with maven shaded plugin 3.5.0

The file under META-INF/services also could be changed, but content didn't.


> Shade plugin can't replace SPI content with correct
> ---
>
> Key: MSHADE-452
> URL: https://issues.apache.org/jira/browse/MSHADE-452
> Project: Maven Shade Plugin
>  Issue Type: Improvement
>Affects Versions: 3.5.0
>Reporter: hk__lrzy
>Priority: Critical
> Attachments: 20230720-205856.png, 20230720-205900.png, 
> image-2023-07-20-21-03-36-444.png
>
>
> We have java path as below
> _*org.apache.demo1*_
> _*org.apache.demo2*_
> In {_}*maven-shade-plugin 3.2.1*{_}, we use relocation to process path and 
> SPI Service file at the same time, and we will follow result.
> {code:java}
> 
> org.apache.demo
> shaded.org.apache.demo
>  {code}
> {code:java}
> META-INF/services/shaded.org.apache.demo{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (MSHADE-452) Shade plugin can't replace SPI content with correct

2023-07-20 Thread hk__lrzy (Jira)


 [ 
https://issues.apache.org/jira/browse/MSHADE-452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

hk__lrzy updated MSHADE-452:

Attachment: image-2023-07-20-21-03-36-444.png

> Shade plugin can't replace SPI content with correct
> ---
>
> Key: MSHADE-452
> URL: https://issues.apache.org/jira/browse/MSHADE-452
> Project: Maven Shade Plugin
>  Issue Type: Improvement
>Affects Versions: 3.5.0
>Reporter: hk__lrzy
>Priority: Critical
> Attachments: 20230720-205856.png, 20230720-205900.png, 
> image-2023-07-20-21-03-36-444.png
>
>
> We have java path like follow examples.
> `org.apache.demo1`
> `org.apache.demo2`
> With maven shaded plugin 3.2.1 
> we can use relocation
> {code:java}
> 
> org.apache.demo
> shaded.org.apache.demo
>  {code}
> to relocate java file and META-INF/services file both.
> But with maven shaded plugin 3.5.0
> The file under META-INF/services also could be changed, but content didn't.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (MSHADE-452) Shade plugin can't replace SPI content with correct

2023-07-20 Thread hk__lrzy (Jira)


 [ 
https://issues.apache.org/jira/browse/MSHADE-452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

hk__lrzy updated MSHADE-452:

Attachment: 20230720-205900.png
20230720-205856.png

> Shade plugin can't replace SPI content with correct
> ---
>
> Key: MSHADE-452
> URL: https://issues.apache.org/jira/browse/MSHADE-452
> Project: Maven Shade Plugin
>  Issue Type: Improvement
>Affects Versions: 3.5.0
>Reporter: hk__lrzy
>Priority: Critical
> Attachments: 20230720-205856.png, 20230720-205900.png
>
>
> We have java path like follow examples.
> `org.apache.demo1`
> `org.apache.demo2`
> With maven shaded plugin 3.2.1 
> we can use relocation
> {code:java}
> 
> org.apache.demo
> shaded.org.apache.demo
>  {code}
> to relocate java file and META-INF/services file both.
> But with maven shaded plugin 3.5.0
> The file under META-INF/services also could be changed, but content didn't.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (MSHADE-452) Shade plugin can't replace SPI content with correct

2023-07-20 Thread hk__lrzy (Jira)


 [ 
https://issues.apache.org/jira/browse/MSHADE-452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

hk__lrzy updated MSHADE-452:

  Flags: Important
Description: 
We have java path like follow examples.
`org.apache.demo1`

`org.apache.demo2`

With maven shaded plugin 3.2.1 
we can use relocation
{code:java}

org.apache.demo
shaded.org.apache.demo
 {code}
to relocate java file and META-INF/services file both.
But with maven shaded plugin 3.5.0

The file under META-INF/services also could be changed, but content didn't.

  was:In version 3.2.1


> Shade plugin can't replace SPI content with correct
> ---
>
> Key: MSHADE-452
> URL: https://issues.apache.org/jira/browse/MSHADE-452
> Project: Maven Shade Plugin
>  Issue Type: Improvement
>Affects Versions: 3.5.0
>Reporter: hk__lrzy
>Priority: Critical
>
> We have java path like follow examples.
> `org.apache.demo1`
> `org.apache.demo2`
> With maven shaded plugin 3.2.1 
> we can use relocation
> {code:java}
> 
> org.apache.demo
> shaded.org.apache.demo
>  {code}
> to relocate java file and META-INF/services file both.
> But with maven shaded plugin 3.5.0
> The file under META-INF/services also could be changed, but content didn't.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Created] (MSHADE-452) Shade plugin can't replace SPI content with correct

2023-07-20 Thread hk__lrzy (Jira)
hk__lrzy created MSHADE-452:
---

 Summary: Shade plugin can't replace SPI content with correct
 Key: MSHADE-452
 URL: https://issues.apache.org/jira/browse/MSHADE-452
 Project: Maven Shade Plugin
  Issue Type: Improvement
Affects Versions: 3.5.0
Reporter: hk__lrzy


In version 3.2.1



--
This message was sent by Atlassian Jira
(v8.20.10#820010)