maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominik Süß (JIRA) <>
Subject [jira] [Commented] (MSHADE-156) shade plugin is transforming also strings that are not supposed to be transformed
Date Mon, 12 Nov 2018 10:33:00 GMT


Dominik Süß commented on MSHADE-156:

This one made me curse quite a lot the last hours - to work around I now "marked" the string
and let the relocation undo this marker to restore the value I need. In my case this is about
a tool that generates some configs while the class to be configured (Osgi Config) is being
loaded in this tool as well. The name of the config contains the FQCN so it gets unintentionally
relocated. I rarely have seen cases were the relocation of values within Strings is intended
- there should be at least an optional parameter within the relocation rule to exclude occurrences
in strings.

> shade plugin is transforming also strings that are not supposed to be transformed
> ---------------------------------------------------------------------------------
>                 Key: MSHADE-156
>                 URL:
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 2.1
>            Reporter: Neeme Praks
>            Priority: Major
>             Fix For: backlog
> I'm shading several third party libraries into a single JAR. In the context of this issue,
there are two important libraries:
> 1. com.nothome:javaxdelta:2.0.1 - this library is in "at.spardat.xma.xdelta" package.
> 2. ch.qos.logback:logback-classic:1.0.11 - in this library, in class ch.qos.logback.classic.spi.StackTraceElementProxy,
there is a method to convert stack trace elements into strings:
> {code}
>   public String getSTEAsString() {
>     if (steAsString == null) {
>       steAsString = "at " + ste.toString();
>     }
>     return steAsString;
>   }
> {code}
> I use "org.myorgname.appname.shaded" package for shading.
> During shading, the constant "at " is replaced with ""
-- shade plugin thinks that the "at" in the beginning of that string is a package name and
shades it.
> This results in an unfortunate side-effect: all logged stack traces now look like this:
> {noformat}
> Caused by: error in opening zip file
> Method) ~[na:1.6.0_19]
> {noformat}
> Possible fixes:
> * instead of just checking the first part of the package (at), check for the full package
> * allow to configure shade plugin to ignore certain string constants in certain classes
(this would solve also some other issues we have with shade plugin being too eager).
> * both of the above.

This message was sent by Atlassian JIRA

View raw message