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


##########
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:
   My usual use case is something like Netty being shaded into some sort of 
connector library JAR under a different package so that the connector does not 
depend on Netty version in dependencies. Renaming the packages in the normal 
JAR and distributing that, if I understand you correctly, sound unusual to me. 
But I accept that I don't know all the people's use cases.
   
   I will add a way to change the module name, if possible. 



-- 
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