You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Anurag Shekhar <an...@gmail.com> on 2020/06/26 06:30:09 UTC

shade plugin modifying string constants

Hi

I am trying to shade a package with following tags

<relocation>
     <pattern>org.example.pkg</pattern>
<shadedPattern>org.example.shaded.pkg</shadedPattern>
</relocation>

I also have a string in one of my class which matches the pattern gets

modified during shading

     public static void main (String [] args) {
         System.out.println ("org.example.pkg."); //prints 
org.example.shaded.pkg.
         System.out.println ("org.example.PKG.".toLowerCase()); //prints 
org.example.pkg.
     }

Is this expected behavior ?

I was thinking about making use of this behavior. Will it be safe to do so ?

Or its something undocumented so might change without prior notice ?


thanks

Anurag


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: shade plugin modifying string constants

Posted by Anurag Shekhar <an...@gmail.com>.
Thank you for your reply.

On 6/27/20 3:21 PM, John Patrick wrote:
>  From the views of a another user, relocation should be dumb and should
> be exact case sensitive for both pattern and shadedPattern. So I would
> not expect PKG to be altered. Yes the output is what your pattern
> match lists but but so does; System.out.println ("org.example" +
> ".pkg."); and I wouldn't expect that to be changed.
That clarifies my confusion.
> Based on your example would you have expect it to be replaced with
> either A or B;
> a) org.example.shaded.PKG
> b) org.example.shaded.pkg

I wasn't expecting the capitalized name to undergo replacement. I had

added second println just for my clarity and didn't remove while posting

in the mailing list.

Thanks

anurag


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: shade plugin modifying string constants

Posted by John Patrick <nh...@gmail.com>.
From the views of a another user, relocation should be dumb and should
be exact case sensitive for both pattern and shadedPattern. So I would
not expect PKG to be altered. Yes the output is what your pattern
match lists but but so does; System.out.println ("org.example" +
".pkg."); and I wouldn't expect that to be changed.

Based on your example would you have expect it to be replaced with
either A or B;
a) org.example.shaded.PKG
b) org.example.shaded.pkg

John

On Fri, 26 Jun 2020 at 07:30, Anurag Shekhar
<an...@gmail.com> wrote:
>
> Hi
>
> I am trying to shade a package with following tags
>
> <relocation>
>      <pattern>org.example.pkg</pattern>
> <shadedPattern>org.example.shaded.pkg</shadedPattern>
> </relocation>
>
> I also have a string in one of my class which matches the pattern gets
>
> modified during shading
>
>      public static void main (String [] args) {
>          System.out.println ("org.example.pkg."); //prints
> org.example.shaded.pkg.
>          System.out.println ("org.example.PKG.".toLowerCase()); //prints
> org.example.pkg.
>      }
>
> Is this expected behavior ?
>
> I was thinking about making use of this behavior. Will it be safe to do so ?
>
> Or its something undocumented so might change without prior notice ?
>
>
> thanks
>
> Anurag
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org