Maven shade plugin: Duplicate entry in META-INF/service

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Maven shade plugin: Duplicate entry in META-INF/service

Jan Lukavský
Hi Maven :),

I encountered an exception in my build and I'm not sure if there is
something wrong with how I structure tasks in my pom.xml, or there is a
room for improvement of the shade plugin.

The symptoms are as follows:

  - mvn install works just fine

  - mvn deploy fails on 'duplicate error: META-INF/service/....' while
shading test jar

The reason for that seems that it includes the regular (not test-jar),
and that one already includes the shaded service. When shading with the
other dependencies, this fails. I managed to fix this locally with [1],
but I'm not sure if this is a proper fix. I didn't fill any JIRA yet,
because I wanted to check with you what the best solution should look
like. I also don't know when or how this broke, but at least somewhat in
early 2019 this worked. I probably changed the shade plugin to latest
version later this year.

Thanks for comments and suggestions!

Jan

[1] https://github.com/apache/maven-shade-plugin/pull/32


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Maven shade plugin: Duplicate entry in META-INF/service

Jan Lukavský
Hi Matt,

thanks for reaction. Is there a workaround around this? I think that the
PR I propose is "safe" and might be considered as a hotfix before a
proper solution is found? I don't know how is the release cycle of maven
plugins defined, but if there is an upcoming release soon, this might help?

Jan

On 12/2/19 8:06 PM, Matt Foley wrote:

> Hi Jan,
> See also https://github.com/apache/maven-shade-plugin/pull/14 and MSHADE-259
>
> I stalled on it because it appears to be a lot of work to create unit tests for maven plugins — and there weren’t examples to follow in the shade plugin.
> That said, I’m not sure what I did is the right way to fix it.  I’ve seen emails go by that indicate the possibility of duplication in attachment lists affects several plugins, and the best way would be a global change in the underlying methods for “attachArtifact” that checks to see if the requested item is already there and not duplicate it if so (without error).
>
> Regards,
> —Matt
>
> On Nov 28, 2019, at 7:03 AM, Jan Lukavský <[hidden email]> wrote:
>
> Hi Maven :),
>
> I encountered an exception in my build and I'm not sure if there is something wrong with how I structure tasks in my pom.xml, or there is a room for improvement of the shade plugin.
>
> The symptoms are as follows:
>
>   - mvn install works just fine
>
>   - mvn deploy fails on 'duplicate error: META-INF/service/....' while shading test jar
>
> The reason for that seems that it includes the regular (not test-jar), and that one already includes the shaded service. When shading with the other dependencies, this fails. I managed to fix this locally with [1], but I'm not sure if this is a proper fix. I didn't fill any JIRA yet, because I wanted to check with you what the best solution should look like. I also don't know when or how this broke, but at least somewhat in early 2019 this worked. I probably changed the shade plugin to latest version later this year.
>
> Thanks for comments and suggestions!
>
> Jan
>
> [1] https://github.com/apache/maven-shade-plugin/pull/32
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]