apache / apache/maven-shade-plugin

[MSHADE-332] Add a log when original artifact already exist and is not replaced

Open Beginner friendly
#334 0 comments 0 reactions 0 assignees View on GitHub
enhancement priority:minor
Dominant language
Java
Stars
188
Forks
103
Avg merge
16h 39m
Merged PRs (30d)
4

Description

**[Benjamin Cartereau](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=benjamin.cartereau)** opened **[MSHADE-332](https://issues.apache.org/jira/browse/MSHADE-332?redirect=false)** and commented

When using the plugin (defaut config, just include a dependency) to build a project (mvn clean package), I end up having :
* original-xxxx.jar
* xxxx.jar (the shaded uber jar)

If I do a 2nd build (mvn package) without a clean, I end up having :
* original-xxxx.jar
* xxxx.jar (the shaded uber jar)
* xxxx-shaded.jar (the shaded uber jar too)

I don't know if it is the expected behavior. _In my case I was then using the assembly plugin and in some case (not doing a clean before a build) I did include the xxxx-shaded.jar artefact and it was not the expected behavior to me. So it is not excluded from my assembly descriptor._

But at least it would be great to have a log that says the shaded artifact will not be deleted.
If I am right, it is happening after the log message that says "Replacing original artifact with shaded artifact."

And, in fact, it is not always "replaced":
https://github.com/apache/maven-shade-plugin/blob/maven-shade-plugin-3.2.1/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java#L512

 Thanks

---

**Affects:** 3.2.1

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java around line 512, where the existing “Replacing original artifact with shaded artifact.” message is emitted. Trace the condition that leaves the original artifact in place and verify that the log distinguishes this case; the work is done when users can tell from the build log that the shaded artifact was not replaced or deleted.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.