wilx commented on code in PR #829:
URL: 
https://github.com/apache/maven-shade-plugin/pull/829#discussion_r3864959745


##########
src/site/markdown/examples/module-info-merging.md.vm:
##########
@@ -0,0 +1,200 @@
+---
+title: Merging Java Module Descriptors
+author:
+  - The Apache Maven Team
+date: 2026-07-30
+---
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Merging Java Module Descriptors
+
+By default, the plugin discards every root and versioned `module-info.class` 
from the inputs. This preserves the
+historical behavior: an unmodified descriptor would describe the original 
artifact rather than the contents of the
+shaded JAR.
+
+Modular projects can opt into descriptor merging:
+
+```xml
+<project>
+  ...
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <moduleInfoMode>merge</moduleInfoMode>
+              <moduleInfo>
+                <publicBoundary>merge</publicBoundary>
+                <analysisJdkToolchain>
+                  <version>21</version>
+                </analysisJdkToolchain>
+              </moduleInfo>
+              <relocations>
+                <relocation>
+                  <pattern>com.example.internal</pattern>
+                  <shadedPattern>com.example.shaded.internal</shadedPattern>
+                </relocation>
+              </relocations>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  ...
+</project>
+```
+
+Merge mode models the shaded JAR as if the retained, relocated source files 
had been compiled together as one module.
+The primary artifact remains authoritative for the module name, version, main 
class, and, by default, the public

Review Comment:
   Well, if you enable the modules merging in your plugin configuration then 
you are agreeing to have a module. It needs a name. Changing it does not make 
much sense to me. Users of your project either want to use the original JAR or 
the shaded JAR, not both at the same time. So having the same module name as 
the original JAR does not look like a problem.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to