This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-shade-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 828530e  [MSHADE-380] Explain the overlap warnings of a build without 
clean in the FAQ
828530e is described below

commit 828530e4bad42ee6c5ef4150c8bc8ee4b2ad1f41
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Mon Nov 2 14:49:43 2026 +0000

    [MSHADE-380] Explain the overlap warnings of a build without clean in the 
FAQ
---
 src/site/markdown/faq.md | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/src/site/markdown/faq.md b/src/site/markdown/faq.md
index a96086a..74829cb 100644
--- a/src/site/markdown/faq.md
+++ b/src/site/markdown/faq.md
@@ -26,6 +26,7 @@ under the License.
 # Frequently Asked Questions
 
 1. [Why Does My Second Shade Include The Results Of The First 
Execution?](#two-executions)
+2. [Why Does Shade Report Hundreds Of Overlapping Classes When I Build Without 
`clean`?](#without-clean)
 
 <a id="two-executions"></a>
 
@@ -38,3 +39,32 @@ So, when a `pom.xml` includes two shades, the second shade 
execution will
 If you're looking for two independent shades then read in
 [shade:shade](shade-mojo.html) about ways choose a different name for your
 first shade.
+
+<a id="without-clean"></a>
+
+### Why Does Shade Report Hundreds Of Overlapping Classes When I Build Without 
`clean`?
+
+When nothing changed since the last build, the Maven JAR Plugin keeps the 
existing JAR instead of creating it again.
+Since shade replaced that JAR with the shaded one, the next build, for example 
`mvn install` right after `mvn verify`,
+shades the shaded JAR again: every class of the dependencies is then found 
twice, and shade warns about each of them.
+
+Build with `clean`, or make the JAR plugin create the JAR on every build with 
its
+[`forceCreation`](/plugins/maven-jar-plugin/jar-mojo.html#forceCreation) 
parameter:
+
+```xml
+<plugin>
+  <groupId>org.apache.maven.plugins</groupId>
+  <artifactId>maven-jar-plugin</artifactId>
+  <executions>
+    <execution>
+      <id>default-jar</id>
+      <configuration>
+        <forceCreation>true</forceCreation>
+      </configuration>
+    </execution>
+  </executions>
+</plugin>
+```
+
+Renaming the shaded JAR with `finalName` also avoids the second shading, but 
then the project's main artifact, which
+`install` and `deploy` publish, is the JAR without its dependencies.

Reply via email to