apache / apache/maven-shade-plugin

[MSHADE-367] ServicesResourceTransformer & relocation together cause issues with "reshading"

Open
#571 1 comment 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
188
Forks
103
Avg merge
16h 39m
Merged PRs (30d)
4

Description

**[Chris Dennis](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=chrisdennis)** opened **[MSHADE-367](https://issues.apache.org/jira/browse/MSHADE-367?redirect=false)** and commented

The attached sample project shades `org.terracotta:a` in to `org.terracotta:b`. Both a and b declare an implementation of a shared service interface `org.terracotta.Service`. When you `mvn package` this project everything works as it should. If you run `mvn package` again without cleaning first plugin appears to attempt to shade on top of itself and complains that the service file colliides in the JAR file. This issue is hitting us during our build process. We have worked around it by having a task delete the shade output during the pre-package phase but would appreciate a better solution.

---

**Affects:** 3.2.3

**Attachments:**
- [maven-shade-bug.zip](https://issues.apache.org/jira/secure/attachment/13003321/maven-shade-bug.zip) (_4.26 kB_)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the attached maven-shade-bug.zip sample project and run mvn package twice without cleaning to reproduce the ServicesResourceTransformer and relocation collision. Trace how the shade output is reused during the second package, then verify that repeated packaging completes successfully and produces the expected shaded JAR without requiring a cleanup task.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.