You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Alexander Kriegisch <al...@kriegisch.name> on 2021/05/16 02:41:19 UTC

Why does Maven Shade relocate modify unrelated classes?

When running Maven Shade with relocation, it works nicely. When
comparing JARs before and after relocation, I was surprised to see that
Shade not just modifies the relocated classes and classes referencing
them, but also a bunch of IMO completely unrelated classes. In my case I
am transforming an uber JAR containing ASM, and I selectively relocate
the ASM classes, intending to leave all others untouched. I know that
ASM classes are referred to by some of the other classes, but by no
means as many as are being modified. The byte code is slightly
different, probably still does the same thing, but it makes comparisons
and sanity checks or automatic verification steps harder than necessary.
BTW, the same Shade execution also relocates the sources and really only
changes source files referencing ASM, just like I would have expected.

Looking forward to your insights
-- 
Alexander Kriegisch
https://scrum-master.de

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


Re: Why does Maven Shade relocate modify unrelated classes?

Posted by Alexander Kriegisch <al...@kriegisch.name>.
MSHADE-252
https://github.com/apache/maven-shade-plugin/pull/88

Mentioned multiple times here, too, even very recently again. I am
feeling awkward, posting the link again, but I keep getting asked about
it, so I am replying. My apologies to everyone else who reads about this
PR again.


Tibor Digana schrieb am 16.05.2021 18:23 (GMT +07:00):

> Where is the ticket in Jira?
>
> Last time I meant when Romain improved the plugin a lot. Maybe before you
> created the ticket.

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


Re: Why does Maven Shade relocate modify unrelated classes?

Posted by Tibor Digana <ti...@apache.org>.
Where is the ticket in Jira?
Last time I meant when Romain improved the plugin a lot. Maybe before you
created the ticket.
T

On Sun, May 16, 2021 at 1:01 PM Alexander Kriegisch <
alexander@kriegisch.name> wrote:

> Sorry Tibor, I am not sure which "last time" you are talking about. I
> think, last time I interacted with anyone concerning Maven Shade on Jira
> was by commenting on an old, existing ticket, getting zero help and then
> fixing the problem myself, trying return something to the community by
> means of an utterly ignored pull request. Hence, I thought I try a
> channel other than Jira and a simple question istead of a PR this time.
> It seems to me, whichever way I choose, it is considered to be wrong.
> What would you have me do? Open a Jira issue, sending a link to the OSS
> project I am working on and which reproduces the mentioned behaviour?
> Maybe a screenshot of me "diffing" the two JARs before and after
> relocation? I am willing to provide any kind of information which makes
> someone engange in investigating and finally answering my question. Just
> kindly let me know how to do it right this time.
>
>
> Tibor Digana schrieb am 16.05.2021 17:16 (GMT +07:00):
>
> > These Apache developers work with Jira based on objective materials
> > attached to Jira, like a reproducible project provided by you on Github
> or
> > a provided POM.
> > Then they will take care especially regarding the maven-shade-plugin they
> > want to improve this plugin, and there was a big effort given to this
> > plugin last time, so I am sure they want to handle the bugs in Jira
> again.
> > T
> >
> > On Sun, May 16, 2021 at 4:41 AM Alexander Kriegisch <
> > alexander@kriegisch.name> wrote:
> >
> >> When running Maven Shade with relocation, it works nicely. When
> >> comparing JARs before and after relocation, I was surprised to see that
> >> Shade not just modifies the relocated classes and classes referencing
> >> them, but also a bunch of IMO completely unrelated classes. In my case I
> >> am transforming an uber JAR containing ASM, and I selectively relocate
> >> the ASM classes, intending to leave all others untouched. I know that
> >> ASM classes are referred to by some of the other classes, but by no
> >> means as many as are being modified. The byte code is slightly
> >> different, probably still does the same thing, but it makes comparisons
> >> and sanity checks or automatic verification steps harder than necessary.
> >> BTW, the same Shade execution also relocates the sources and really only
> >> changes source files referencing ASM, just like I would have expected.
> >>
> >> Looking forward to your insights
> >> --
> >> Alexander Kriegisch
> >> https://scrum-master.de
> >>
> >> ---------------------------------------------------------------------
> >> 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
>
>

Re: Why does Maven Shade relocate modify unrelated classes?

Posted by Alexander Kriegisch <al...@kriegisch.name>.
Sorry Tibor, I am not sure which "last time" you are talking about. I
think, last time I interacted with anyone concerning Maven Shade on Jira
was by commenting on an old, existing ticket, getting zero help and then
fixing the problem myself, trying return something to the community by
means of an utterly ignored pull request. Hence, I thought I try a
channel other than Jira and a simple question istead of a PR this time.
It seems to me, whichever way I choose, it is considered to be wrong.
What would you have me do? Open a Jira issue, sending a link to the OSS
project I am working on and which reproduces the mentioned behaviour?
Maybe a screenshot of me "diffing" the two JARs before and after
relocation? I am willing to provide any kind of information which makes
someone engange in investigating and finally answering my question. Just
kindly let me know how to do it right this time.


Tibor Digana schrieb am 16.05.2021 17:16 (GMT +07:00):

> These Apache developers work with Jira based on objective materials
> attached to Jira, like a reproducible project provided by you on Github or
> a provided POM.
> Then they will take care especially regarding the maven-shade-plugin they
> want to improve this plugin, and there was a big effort given to this
> plugin last time, so I am sure they want to handle the bugs in Jira again.
> T
> 
> On Sun, May 16, 2021 at 4:41 AM Alexander Kriegisch <
> alexander@kriegisch.name> wrote:
> 
>> When running Maven Shade with relocation, it works nicely. When
>> comparing JARs before and after relocation, I was surprised to see that
>> Shade not just modifies the relocated classes and classes referencing
>> them, but also a bunch of IMO completely unrelated classes. In my case I
>> am transforming an uber JAR containing ASM, and I selectively relocate
>> the ASM classes, intending to leave all others untouched. I know that
>> ASM classes are referred to by some of the other classes, but by no
>> means as many as are being modified. The byte code is slightly
>> different, probably still does the same thing, but it makes comparisons
>> and sanity checks or automatic verification steps harder than necessary.
>> BTW, the same Shade execution also relocates the sources and really only
>> changes source files referencing ASM, just like I would have expected.
>>
>> Looking forward to your insights
>> --
>> Alexander Kriegisch
>> https://scrum-master.de
>>
>> ---------------------------------------------------------------------
>> 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


Re: Why does Maven Shade relocate modify unrelated classes?

Posted by Tibor Digana <ti...@apache.org>.
These Apache developers work with Jira based on objective materials
attached to Jira, like a reproducible project provided by you on Github or
a provided POM.
Then they will take care especially regarding the maven-shade-plugin they
want to improve this plugin, and there was a big effort given to this
plugin last time, so I am sure they want to handle the bugs in Jira again.
T

On Sun, May 16, 2021 at 4:41 AM Alexander Kriegisch <
alexander@kriegisch.name> wrote:

> When running Maven Shade with relocation, it works nicely. When
> comparing JARs before and after relocation, I was surprised to see that
> Shade not just modifies the relocated classes and classes referencing
> them, but also a bunch of IMO completely unrelated classes. In my case I
> am transforming an uber JAR containing ASM, and I selectively relocate
> the ASM classes, intending to leave all others untouched. I know that
> ASM classes are referred to by some of the other classes, but by no
> means as many as are being modified. The byte code is slightly
> different, probably still does the same thing, but it makes comparisons
> and sanity checks or automatic verification steps harder than necessary.
> BTW, the same Shade execution also relocates the sources and really only
> changes source files referencing ASM, just like I would have expected.
>
> Looking forward to your insights
> --
> Alexander Kriegisch
> https://scrum-master.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Why does Maven Shade relocate modify unrelated classes?

Posted by Enrico Olivelli <eo...@gmail.com>.
Alexander,
thank you for moving forward with this and come to provide a patch

I am generally +1 with the patch, but I left some comment
https://github.com/apache/maven-shade-plugin/pull/95

let's follow up on the PR

Enrico

Il giorno ven 21 mag 2021 alle ore 11:41 Alexander Kriegisch
<al...@kriegisch.name> ha scritto:
>
> Just so as to wrap it up here, in case anyone is interested in the topic
> as such instead on the meta discussion that ensued before:
>
> https://issues.apache.org/jira/browse/MSHADE-391
> https://github.com/apache/maven-shade-plugin/pull/95
>
> --
> Alexander Kriegisch
> https://scrum-master.de
>
>
> Alexander Kriegisch schrieb am 16.05.2021 09:41 (GMT +07:00):
>
> > When running Maven Shade with relocation, it works nicely. When
> > comparing JARs before and after relocation, I was surprised to see
> > that Shade not just modifies the relocated classes and classes
> > referencing them, but also a bunch of IMO completely unrelated
> > classes. In my case I am transforming an uber JAR containing ASM, and
> > I selectively relocate the ASM classes, intending to leave all others
> > untouched. I know that ASM classes are referred to by some of the
> > other classes, but by no means as many as are being modified. The byte
> > code is slightly different, probably still does the same thing, but it
> > makes comparisons and sanity checks or automatic verification steps
> > harder than necessary. BTW, the same Shade execution also relocates
> > the sources and really only changes source files referencing ASM, just
> > like I would have expected.
> >
> > Looking forward to your insights
>
> ---------------------------------------------------------------------
> 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


Re: Why does Maven Shade relocate modify unrelated classes?

Posted by Alexander Kriegisch <al...@kriegisch.name>.
Just so as to wrap it up here, in case anyone is interested in the topic
as such instead on the meta discussion that ensued before:

https://issues.apache.org/jira/browse/MSHADE-391
https://github.com/apache/maven-shade-plugin/pull/95

-- 
Alexander Kriegisch
https://scrum-master.de


Alexander Kriegisch schrieb am 16.05.2021 09:41 (GMT +07:00):

> When running Maven Shade with relocation, it works nicely. When
> comparing JARs before and after relocation, I was surprised to see
> that Shade not just modifies the relocated classes and classes
> referencing them, but also a bunch of IMO completely unrelated
> classes. In my case I am transforming an uber JAR containing ASM, and
> I selectively relocate the ASM classes, intending to leave all others
> untouched. I know that ASM classes are referred to by some of the
> other classes, but by no means as many as are being modified. The byte
> code is slightly different, probably still does the same thing, but it
> makes comparisons and sanity checks or automatic verification steps
> harder than necessary. BTW, the same Shade execution also relocates
> the sources and really only changes source files referencing ASM, just
> like I would have expected.
> 
> Looking forward to your insights

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


Re: Why does Maven Shade relocate modify unrelated classes?

Posted by Alexander Kriegisch <al...@kriegisch.name>.
Jim N schrieb am 16.05.2021 18:27 (GMT +07:00):

> im not sure whether the prior response fully bounced, so forgive the
> duplication:
> 
> This is the maven users list not the shade issues tracker. expect
> helpful suggestions that don't share your viewpoints or goals.

Looks like it did, I did not get anything of that sort before in this
thread. Now I know what you are talking about.

Actually, I open issues if I think I found a bug or a usability problem,
not for general inquiries about a plugin's behaviour. The latter is what
my question is about. Sorry if this is off-topic here. Shade is a core
Maven plugin, so I thought it was appropriate to ask here. If I would
have gotten an answer like "this sounds weird and should not happen,
please open a ticket with a reproducible example" or "this is to be
expected, because Shade also re-writes classes it does not relocate",
then I would have known what to do next and whether to just feel good
about the current behaviour or to open an issue in the tracker.

------------------------------------------------------------------------

Now for the off-topic stuff (sorry to everyone, but I did not start
this):

> I'd suggest you find the shade plugin source code and resist the urge
> to mix words like "horrible" with responses that lack grattitude.

I did not say "horrible" in this thread. I used the term a while ago in
a completely different topic, this one is unrelated. And I used it,
because someone (don't remember who) suggested, to just not use any
Maven pluging but script my build. Sorry if I feel somewhat strongly
about this topic on a mailing list where other people get scolded for
doing things not the "Maven way" and for actually believing in the
"Maven way" myself. Furthermore, in that other thread in my question I
already explained that I have a working Maven solution, but just feel it
is awkward and explicitly asked for a *more canonical* one, not a less
canonical one.

> FYI To unsubscribe, e-mail: users-unsubscribe@maven.apache.org

Why are you being sarcastic and condescending? Did I abuse you in a
previous life? I do not wish to unsubscribe. I am happy to be here.
Sometimes I answer someone's question, sometimes I am asking one.


> On Sun, May 16, 2021 at 6:55 PM Alexander Kriegischwrote:
>> 
>> I have no idea what you are talking about and how your answer
>> concerning "non-relocating options" is relevant to my question about
>> the opposite. I also did not report any surprises during my
>> deployments or runtime behaviour of relocated classes. Thanks for
>> your feedback anyway. Next time, maybe try to contribute a
>> constructive answer instead of a destructive comment, or refrain from
>> replying at all. I would be much obliged. The way you replied sounds
>> just enigmatic at best, lecturing trying to make me feel stupid
>> otherwise. Not helpful!
>> 
>> 
>>> You might want to examine the "horrible" Non relocating options
>>> previously outlined if you want a fast resolution to unsurprising
>>> deployments.
>>> 
>>> 
>>> On Sun, May 16, 2021, 10:41 AM Alexander Kriegisch wrote:
>>> 
>>>> When running Maven Shade with relocation, it works nicely. When
>>>> comparing JARs before and after relocation, I was surprised to see
>>>> that Shade not just modifies the relocated classes and classes
>>>> referencing them, but also a bunch of IMO completely unrelated
>>>> classes. In my case I am transforming an uber JAR containing ASM,
>>>> and I selectively relocate the ASM classes, intending to leave all
>>>> others untouched. I know that ASM classes are referred to by some
>>>> of the other classes, but by no means as many as are being
>>>> modified. The byte code is slightly different, probably still does
>>>> the same thing, but it makes comparisons and sanity checks or
>>>> automatic verification steps harder than necessary. BTW, the same
>>>> Shade execution also relocates the sources and really only changes
>>>> source files referencing ASM, just like I would have expected.

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


Re: Why does Maven Shade relocate modify unrelated classes?

Posted by Jim N <no...@gmail.com>.
im not sure whether the prior response fully bounced, so forgive the
duplication:

This is the maven users list not the shade issues tracker.  expect
helpful suggestions that don't share your viewpoints or goals.

I'd suggest you find the shade plugin source code and resist the urge
to mix words like "horrible" with responses that lack grattitude.

Once again, Good luck

FYI To unsubscribe, e-mail: users-unsubscribe@maven.apache.org

On Sun, May 16, 2021 at 6:55 PM Alexander Kriegisch
<al...@kriegisch.name> wrote:
>
> I have no idea what you are talking about and how your answer concerning
> "non-relocating options" is relevant to my question about the opposite.
> I also did not report any surprises during my deployments or runtime
> behaviour of relocated classes. Thanks for your feedback anyway. Next
> time, maybe try to contribute a constructive answer instead of a
> destructive comment, or refrain from replying at all. I would be much
> obliged. The way you replied sounds just enigmatic at best, lecturing
> trying to make me feel stupid otherwise. Not helpful!
>
>
> > You might want to examine the "horrible" Non relocating options
> > previously outlined if you want a fast resolution to unsurprising
> > deployments.
> >
> >
> > On Sun, May 16, 2021, 10:41 AM Alexander Kriegisch wrote:
> >
> >> When running Maven Shade with relocation, it works nicely. When
> >> comparing JARs before and after relocation, I was surprised to see
> >> that Shade not just modifies the relocated classes and classes
> >> referencing them, but also a bunch of IMO completely unrelated
> >> classes. In my case I am transforming an uber JAR containing ASM, and
> >> I selectively relocate the ASM classes, intending to leave all others
> >> untouched. I know that ASM classes are referred to by some of the
> >> other classes, but by no means as many as are being modified. The
> >> byte code is slightly different, probably still does the same thing,
> >> but it makes comparisons and sanity checks or automatic verification
> >> steps harder than necessary. BTW, the same Shade execution also
> >> relocates the sources and really only changes source files
> >> referencing ASM, just like I would have expected.
>
> ---------------------------------------------------------------------
> 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


Re: Why does Maven Shade relocate modify unrelated classes?

Posted by Alexander Kriegisch <al...@kriegisch.name>.
I have no idea what you are talking about and how your answer concerning
"non-relocating options" is relevant to my question about the opposite.
I also did not report any surprises during my deployments or runtime
behaviour of relocated classes. Thanks for your feedback anyway. Next
time, maybe try to contribute a constructive answer instead of a
destructive comment, or refrain from replying at all. I would be much
obliged. The way you replied sounds just enigmatic at best, lecturing
trying to make me feel stupid otherwise. Not helpful!


> You might want to examine the "horrible" Non relocating options
> previously outlined if you want a fast resolution to unsurprising
> deployments.
> 
> 
> On Sun, May 16, 2021, 10:41 AM Alexander Kriegisch wrote:
> 
>> When running Maven Shade with relocation, it works nicely. When
>> comparing JARs before and after relocation, I was surprised to see
>> that Shade not just modifies the relocated classes and classes
>> referencing them, but also a bunch of IMO completely unrelated
>> classes. In my case I am transforming an uber JAR containing ASM, and
>> I selectively relocate the ASM classes, intending to leave all others
>> untouched. I know that ASM classes are referred to by some of the
>> other classes, but by no means as many as are being modified. The
>> byte code is slightly different, probably still does the same thing,
>> but it makes comparisons and sanity checks or automatic verification
>> steps harder than necessary. BTW, the same Shade execution also
>> relocates the sources and really only changes source files
>> referencing ASM, just like I would have expected.

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


Re: Why does Maven Shade relocate modify unrelated classes?

Posted by Jim N <no...@gmail.com>.
You might want to examine the "horrible" Non relocating options previously
outlined if you want a fast resolution to unsurprising deployments.

On Sun, May 16, 2021, 10:41 AM Alexander Kriegisch <al...@kriegisch.name>
wrote:

> When running Maven Shade with relocation, it works nicely. When
> comparing JARs before and after relocation, I was surprised to see that
> Shade not just modifies the relocated classes and classes referencing
> them, but also a bunch of IMO completely unrelated classes. In my case I
> am transforming an uber JAR containing ASM, and I selectively relocate
> the ASM classes, intending to leave all others untouched. I know that
> ASM classes are referred to by some of the other classes, but by no
> means as many as are being modified. The byte code is slightly
> different, probably still does the same thing, but it makes comparisons
> and sanity checks or automatic verification steps harder than necessary.
> BTW, the same Shade execution also relocates the sources and really only
> changes source files referencing ASM, just like I would have expected.
>
> Looking forward to your insights
> --
> Alexander Kriegisch
> https://scrum-master.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>