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

snuyanzin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 3c1e1d9863d [FLINK-40084][build] maven-shade-plugin does not respect 
multi release jars
3c1e1d9863d is described below

commit 3c1e1d9863d6e3248752cfeb0af3021b7dc54753
Author: Sergey Nuyanzin <[email protected]>
AuthorDate: Thu Jul 9 10:17:41 2026 +0200

    [FLINK-40084][build] maven-shade-plugin does not respect multi release jars
---
 flink-filesystems/flink-azure-fs-hadoop/pom.xml    |  9 +++
 flink-filesystems/flink-fs-hadoop-shaded/pom.xml   | 44 +++++++++++++++
 flink-filesystems/flink-gs-fs-hadoop/pom.xml       |  9 +++
 flink-filesystems/flink-oss-fs-hadoop/pom.xml      |  9 +++
 .../flink-sql-avro-confluent-registry/pom.xml      | 48 ++++++++++++++++
 flink-formats/flink-sql-avro/pom.xml               | 40 ++++++++++++++
 flink-kubernetes/pom.xml                           | 32 +++++++++++
 flink-models/flink-model-openai/pom.xml            | 38 +++++++++++++
 flink-models/flink-model-triton/pom.xml            | 33 +++++++++++
 flink-python/pom.xml                               | 64 ++++++++++++++++++++++
 flink-rpc/flink-rpc-akka/pom.xml                   |  2 +
 11 files changed, 328 insertions(+)

diff --git a/flink-filesystems/flink-azure-fs-hadoop/pom.xml 
b/flink-filesystems/flink-azure-fs-hadoop/pom.xml
index d9796a29116..9794679b181 100644
--- a/flink-filesystems/flink-azure-fs-hadoop/pom.xml
+++ b/flink-filesystems/flink-azure-fs-hadoop/pom.xml
@@ -162,6 +162,15 @@ under the License.
                                                                        
</excludes>
                                                                </filter>
                                                        </filters>
+                                                       <transformers 
combine.children="append">
+                                                               <!-- Bundled 
flink-fs-hadoop-shaded carries relocated multi-release (jackson) classes;
+                                                                    mark the 
resulting jar as multi-release so the JVM honours META-INF/versions entries. -->
+                                                               <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                                                       
<manifestEntries>
+                                                                               
<Multi-Release>true</Multi-Release>
+                                                                       
</manifestEntries>
+                                                               </transformer>
+                                                       </transformers>
                                                </configuration>
                                        </execution>
                                </executions>
diff --git a/flink-filesystems/flink-fs-hadoop-shaded/pom.xml 
b/flink-filesystems/flink-fs-hadoop-shaded/pom.xml
index e7d4bdfcdcc..8352d69b03f 100644
--- a/flink-filesystems/flink-fs-hadoop-shaded/pom.xml
+++ b/flink-filesystems/flink-fs-hadoop-shaded/pom.xml
@@ -239,6 +239,41 @@ under the License.
                                                                        
<pattern>com.fasterxml</pattern>
                                                                        
<shadedPattern>org.apache.flink.fs.shaded.hadoop3.com.fasterxml</shadedPattern>
                                                                </relocation>
+                                                               <!--
+                                                               Manually 
relocate multi-release classes to the correct shaded package. This is needed
+                                                               due to a bug in 
the Maven Shade plugin, which only relocates the content but not
+                                                               the package 
structure itself, see https://github.com/apache/maven-shade-plugin/issues/652
+                                                               -->
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/com/fasterxml/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/fs/shaded/hadoop3/com/fasterxml/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <!--
+                                                               Same 
maven-shade-plugin#652 workaround as the jackson relocation above, extended to 
every
+                                                               relocated 
package: keep each dependency's multi-release (META-INF/versions/N) classes 
aligned
+                                                               with its 
relocated base classes. No-op for non-multi-release jars.
+                                                               -->
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/com/google/re2j/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/fs/shaded/hadoop3/com/google/re2j/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/org/apache/htrace/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/fs/shaded/hadoop3/org/apache/htrace/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/org/codehaus/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/fs/shaded/hadoop3/org/codehaus/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/com/ctc/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/fs/shaded/hadoop3/com/ctc/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
                                                                <relocation>
                                                                        
<pattern>org.codehaus</pattern>
                                                                        
<shadedPattern>org.apache.flink.fs.shaded.hadoop3.org.codehaus</shadedPattern>
@@ -256,9 +291,18 @@ under the License.
                                                                                
<exclude>PropertyList-1.0.dtd</exclude>
                                                                                
<exclude>META-INF/services/javax.xml.stream.*</exclude>
                                                                                
<exclude>META-INF/LICENSE.txt</exclude>
+                                                                               
<!-- Drop stale JPMS descriptor; after relocation it points at packages that no 
longer exist. -->
+                                                                               
<exclude>META-INF/**/module-info.class</exclude>
                                                                        
</excludes>
                                                                </filter>
                                                        </filters>
+                                                       <transformers 
combine.children="append">
+                                                               <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                                                       
<manifestEntries>
+                                                                               
<Multi-Release>true</Multi-Release>
+                                                                       
</manifestEntries>
+                                                               </transformer>
+                                                       </transformers>
                                                </configuration>
                                        </execution>
                                </executions>
diff --git a/flink-filesystems/flink-gs-fs-hadoop/pom.xml 
b/flink-filesystems/flink-gs-fs-hadoop/pom.xml
index 8372a8f1b97..ec92c44dfae 100644
--- a/flink-filesystems/flink-gs-fs-hadoop/pom.xml
+++ b/flink-filesystems/flink-gs-fs-hadoop/pom.xml
@@ -252,6 +252,15 @@ under the License.
                                                                        
</excludes>
                                                                </filter>
                                                        </filters>
+                                                       <transformers 
combine.children="append">
+                                                               <!-- Bundled 
flink-fs-hadoop-shaded carries relocated multi-release (jackson) classes;
+                                                                    mark the 
resulting jar as multi-release so the JVM honours META-INF/versions entries. -->
+                                                               <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                                                       
<manifestEntries>
+                                                                               
<Multi-Release>true</Multi-Release>
+                                                                       
</manifestEntries>
+                                                               </transformer>
+                                                       </transformers>
                                                </configuration>
                                        </execution>
                                </executions>
diff --git a/flink-filesystems/flink-oss-fs-hadoop/pom.xml 
b/flink-filesystems/flink-oss-fs-hadoop/pom.xml
index f4352b1c692..d6bb8c51a3c 100644
--- a/flink-filesystems/flink-oss-fs-hadoop/pom.xml
+++ b/flink-filesystems/flink-oss-fs-hadoop/pom.xml
@@ -178,6 +178,15 @@ under the License.
                                                                        
</excludes>
                                                                </filter>
                                                        </filters>
+                                                       <transformers 
combine.children="append">
+                                                               <!-- Bundled 
flink-fs-hadoop-shaded carries relocated multi-release (jackson) classes;
+                                                                    mark the 
resulting jar as multi-release so the JVM honours META-INF/versions entries. -->
+                                                               <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                                                       
<manifestEntries>
+                                                                               
<Multi-Release>true</Multi-Release>
+                                                                       
</manifestEntries>
+                                                               </transformer>
+                                                       </transformers>
                                                </configuration>
                                        </execution>
                                </executions>
diff --git a/flink-formats/flink-sql-avro-confluent-registry/pom.xml 
b/flink-formats/flink-sql-avro-confluent-registry/pom.xml
index d2b92fc649d..2509b30aa72 100644
--- a/flink-formats/flink-sql-avro-confluent-registry/pom.xml
+++ b/flink-formats/flink-sql-avro-confluent-registry/pom.xml
@@ -89,6 +89,41 @@ under the License.
                                                                        
<pattern>com.fasterxml.jackson</pattern>
                                                                        
<shadedPattern>org.apache.flink.avro.shaded.com.fasterxml.jackson</shadedPattern>
                                                                </relocation>
+                                                               <!--
+                                                               Manually 
relocate multi-release classes to the correct shaded package. This is needed
+                                                               due to a bug in 
the Maven Shade plugin, which only relocates the content but not
+                                                               the package 
structure itself, see https://github.com/apache/maven-shade-plugin/issues/652
+                                                               -->
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/com/fasterxml/jackson/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/avro/shaded/com/fasterxml/jackson/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <!--
+                                                               Same 
maven-shade-plugin#652 workaround as the jackson relocation above, extended to 
every
+                                                               relocated 
package: keep each dependency's multi-release (META-INF/versions/N) classes 
aligned
+                                                               with its 
relocated base classes. No-op for non-multi-release jars.
+                                                               -->
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/org/apache/kafka/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/avro/registry/confluent/shaded/org/apache/kafka/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/io/confluent/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/avro/registry/confluent/shaded/io/confluent/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/org/apache/avro/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/avro/shaded/org/apache/avro/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/org/apache/commons/compress/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/avro/shaded/org/apache/commons/compress/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
                                                                <relocation>
                                                                        
<pattern>org.apache.avro</pattern>
                                                                        
<shadedPattern>org.apache.flink.avro.shaded.org.apache.avro</shadedPattern>
@@ -111,7 +146,20 @@ under the License.
                                                                                
<exclude>common/**</exclude>
                                                                        
</excludes>
                                                                </filter>
+                                                               <filter>
+                                                                       
<artifact>*:*</artifact>
+                                                                       
<excludes>
+                                                                               
<exclude>META-INF/**/module-info.class</exclude>
+                                                                       
</excludes>
+                                                               </filter>
                                                        </filters>
+                                                       <transformers 
combine.children="append">
+                                                               <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                                                       
<manifestEntries>
+                                                                               
<Multi-Release>true</Multi-Release>
+                                                                       
</manifestEntries>
+                                                               </transformer>
+                                                       </transformers>
                                                </configuration>
                                        </execution>
                                </executions>
diff --git a/flink-formats/flink-sql-avro/pom.xml 
b/flink-formats/flink-sql-avro/pom.xml
index d10bfc7a8b2..a40378e1837 100644
--- a/flink-formats/flink-sql-avro/pom.xml
+++ b/flink-formats/flink-sql-avro/pom.xml
@@ -80,6 +80,31 @@ under the License.
                                                                        
<pattern>com.fasterxml.jackson</pattern>
                                                                        
<shadedPattern>org.apache.flink.avro.shaded.com.fasterxml.jackson</shadedPattern>
                                                                </relocation>
+                                                               <!--
+                                                               Manually 
relocate multi-release classes to the correct shaded package. This is needed
+                                                               due to a bug in 
the Maven Shade plugin, which only relocates the content but not
+                                                               the package 
structure itself, see https://github.com/apache/maven-shade-plugin/issues/652
+                                                               -->
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/com/fasterxml/jackson/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/avro/shaded/com/fasterxml/jackson/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <!--
+                                                               Same 
maven-shade-plugin#652 workaround as the jackson relocation above, extended to 
every
+                                                               relocated 
package: keep each dependency's multi-release (META-INF/versions/N) classes 
aligned
+                                                               with its 
relocated base classes. No-op for non-multi-release jars.
+                                                               -->
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/org/apache/commons/compress/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/avro/shaded/org/apache/commons/compress/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/org/apache/avro/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/avro/shaded/org/apache/avro/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
                                                                <relocation>
                                                                        
<pattern>org.apache.commons.compress</pattern>
                                                                        
<shadedPattern>org.apache.flink.avro.shaded.org.apache.commons.compress</shadedPattern>
@@ -89,6 +114,21 @@ under the License.
                                                                        
<shadedPattern>org.apache.flink.avro.shaded.org.apache.avro</shadedPattern>
                                                                </relocation>
                                                        </relocations>
+                                                       <filters>
+                                                               <filter>
+                                                                       
<artifact>*:*</artifact>
+                                                                       
<excludes>
+                                                                               
<exclude>META-INF/**/module-info.class</exclude>
+                                                                       
</excludes>
+                                                               </filter>
+                                                       </filters>
+                                                       <transformers 
combine.children="append">
+                                                               <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                                                       
<manifestEntries>
+                                                                               
<Multi-Release>true</Multi-Release>
+                                                                       
</manifestEntries>
+                                                               </transformer>
+                                                       </transformers>
                                                </configuration>
                                        </execution>
                                </executions>
diff --git a/flink-kubernetes/pom.xml b/flink-kubernetes/pom.xml
index dd44c3cc4b8..329fc3e4311 100644
--- a/flink-kubernetes/pom.xml
+++ b/flink-kubernetes/pom.xml
@@ -220,6 +220,31 @@ under the License.
                                                                        
<pattern>META-INF/versions/9/org/yaml/snakeyaml</pattern>
                                                                        
<shadedPattern>META-INF/versions/9/org/apache/flink/kubernetes/shaded/org/yaml/snakeyaml</shadedPattern>
                                                                </relocation>
+                                                               <!--
+                                                               Same 
maven-shade-plugin#652 workaround as the jackson relocation above, extended to 
every
+                                                               relocated 
package: keep each dependency's multi-release (META-INF/versions/N) classes 
aligned
+                                                               with its 
relocated base classes. No-op for non-multi-release jars.
+                                                               -->
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/okhttp3/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/kubernetes/shaded/okhttp3/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/okio/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/kubernetes/shaded/okio/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/io/fabric8/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/kubernetes/shaded/io/fabric8/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/org/snakeyaml/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/kubernetes/shaded/org/snakeyaml/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
                                                                <relocation>
                                                                        
<pattern>org.yaml</pattern>
                                                                        
<shadedPattern>org.apache.flink.kubernetes.shaded.org.yaml</shadedPattern>
@@ -229,6 +254,13 @@ under the License.
                                                                    
<shadedPattern>org.apache.flink.kubernetes.shaded.io.fabric8</shadedPattern>
                                                                </relocation>
                                                        </relocations>
+                                                       <transformers 
combine.children="append">
+                                                               <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                                                       
<manifestEntries>
+                                                                               
<Multi-Release>true</Multi-Release>
+                                                                       
</manifestEntries>
+                                                               </transformer>
+                                                       </transformers>
                                                </configuration>
                                        </execution>
                                </executions>
diff --git a/flink-models/flink-model-openai/pom.xml 
b/flink-models/flink-model-openai/pom.xml
index de12beca52e..c1f30521919 100644
--- a/flink-models/flink-model-openai/pom.xml
+++ b/flink-models/flink-model-openai/pom.xml
@@ -170,6 +170,31 @@ under the License.
                                                                        
<pattern>com.fasterxml.jackson</pattern>
                                                                        
<shadedPattern>org.apache.flink.model.openai.com.fasterxml.jackson</shadedPattern>
                                                                </relocation>
+                                                               <!--
+                                                               Manually 
relocate multi-release classes to the correct shaded package. This is needed
+                                                               due to a bug in 
the Maven Shade plugin, which only relocates the content but not
+                                                               the package 
structure itself, see https://github.com/apache/maven-shade-plugin/issues/652
+                                                               -->
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/com/fasterxml/jackson/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/model/openai/com/fasterxml/jackson/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <!--
+                                                               Same 
maven-shade-plugin#652 workaround as the jackson relocation above, extended to 
every
+                                                               relocated 
package: keep each dependency's multi-release (META-INF/versions/N) classes 
aligned
+                                                               with its 
relocated base classes. No-op for non-multi-release jars.
+                                                               -->
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/org/apache/httpcomponents/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/model/openai/org/apache/httpcomponents/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/com/squareup/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/model/openai/com/squareup/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
                                                                <relocation>
                                                                        
<pattern>org.apache.httpcomponents</pattern>
                                                                        
<shadedPattern>org.apache.flink.model.openai.org.apache.httpcomponents</shadedPattern>
@@ -186,7 +211,20 @@ under the License.
                                                                                
<exclude>okhttp3/internal/publicsuffix/NOTICE</exclude>
                                                                        
</excludes>
                                                                </filter>
+                                                               <filter>
+                                                                       
<artifact>com.fasterxml.jackson*:*</artifact>
+                                                                       
<excludes>
+                                                                               
<exclude>META-INF/**/module-info.class</exclude>
+                                                                       
</excludes>
+                                                               </filter>
                                                        </filters>
+                                                       <transformers 
combine.children="append">
+                                                               <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                                                       
<manifestEntries>
+                                                                               
<Multi-Release>true</Multi-Release>
+                                                                       
</manifestEntries>
+                                                               </transformer>
+                                                       </transformers>
                                                </configuration>
                                        </execution>
                                </executions>
diff --git a/flink-models/flink-model-triton/pom.xml 
b/flink-models/flink-model-triton/pom.xml
index 2928c3f527d..faa53a9e671 100644
--- a/flink-models/flink-model-triton/pom.xml
+++ b/flink-models/flink-model-triton/pom.xml
@@ -161,6 +161,26 @@ under the License.
                                                                        
<pattern>com.fasterxml.jackson</pattern>
                                                                        
<shadedPattern>org.apache.flink.model.triton.com.fasterxml.jackson</shadedPattern>
                                                                </relocation>
+                                                               <!--
+                                                               Manually 
relocate multi-release classes to the correct shaded package. This is needed
+                                                               due to a bug in 
the Maven Shade plugin, which only relocates the content but not
+                                                               the package 
structure itself, see https://github.com/apache/maven-shade-plugin/issues/652
+                                                               -->
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/com/fasterxml/jackson/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/model/triton/com/fasterxml/jackson/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <!--
+                                                               Same 
maven-shade-plugin#652 workaround as the jackson relocation above, extended to 
every
+                                                               relocated 
package: keep each dependency's multi-release (META-INF/versions/N) classes 
aligned
+                                                               with its 
relocated base classes. No-op for non-multi-release jars.
+                                                               -->
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/com/squareup/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/model/triton/com/squareup/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
                                                                <relocation>
                                                                        
<pattern>com.squareup</pattern>
                                                                        
<shadedPattern>org.apache.flink.model.triton.com.squareup</shadedPattern>
@@ -173,7 +193,20 @@ under the License.
                                                                                
<exclude>okhttp3/internal/publicsuffix/NOTICE</exclude>
                                                                        
</excludes>
                                                                </filter>
+                                                               <filter>
+                                                                       
<artifact>com.fasterxml.jackson*:*</artifact>
+                                                                       
<excludes>
+                                                                               
<exclude>META-INF/**/module-info.class</exclude>
+                                                                       
</excludes>
+                                                               </filter>
                                                        </filters>
+                                                       <transformers 
combine.children="append">
+                                                               <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                                                       
<manifestEntries>
+                                                                               
<Multi-Release>true</Multi-Release>
+                                                                       
</manifestEntries>
+                                                               </transformer>
+                                                       </transformers>
                                                </configuration>
                                        </execution>
                                </executions>
diff --git a/flink-python/pom.xml b/flink-python/pom.xml
index 28390abe8f6..d9703138c55 100644
--- a/flink-python/pom.xml
+++ b/flink-python/pom.xml
@@ -710,6 +710,8 @@ under the License.
                                                                                
<exclude>LICENSE</exclude>
                                                                                
<exclude>META-INF/LICENSE.txt</exclude>
                                                                                
<exclude>*.proto</exclude>
+                                                                               
<!-- Drop stale JPMS descriptors from relocated multi-release jars (e.g. 
jackson, netty) -->
+                                                                               
<exclude>META-INF/**/module-info.class</exclude>
                                                                        
</excludes>
                                                                </filter>
                                                        </filters>
@@ -731,6 +733,61 @@ under the License.
                                                                                
org.apache.flink.api.python.shaded.com.fasterxml.jackson
                                                                        
</shadedPattern>
                                                                </relocation>
+                                                               <!--
+                                                               Manually 
relocate multi-release classes to the correct shaded package. This is needed
+                                                               due to a bug in 
the Maven Shade plugin, which only relocates the content but not
+                                                               the package 
structure itself, see https://github.com/apache/maven-shade-plugin/issues/652
+                                                               -->
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/com/fasterxml/jackson/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/api/python/shaded/com/fasterxml/jackson/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <!--
+                                                               Same 
maven-shade-plugin#652 workaround as the jackson relocation above, extended to 
every
+                                                               relocated 
package: keep each dependency's multi-release (META-INF/versions/N) classes 
aligned
+                                                               with its 
relocated base classes. No-op for non-multi-release jars.
+                                                               -->
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/py4j/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/api/python/shaded/py4j/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/net/razorvine/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/api/python/shaded/net/razorvine/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/org/joda/time/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/api/python/shaded/org/joda/time/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/com/google/protobuf/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/api/python/shaded/com/google/protobuf/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/org/apache/arrow/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/api/python/shaded/org/apache/arrow/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/io/netty/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/api/python/shaded/io/netty/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/com/google/flatbuffers/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/api/python/shaded/com/google/flatbuffers/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
+                                                               <relocation>
+                                                                       
<pattern>META-INF/versions/(\d+)/org/apache/avro/</pattern>
+                                                                       
<shadedPattern>META-INF/versions/$1/org/apache/flink/avro/shaded/org/apache/avro/</shadedPattern>
+                                                                       
<rawString>true</rawString>
+                                                               </relocation>
                                                                <relocation>
                                                                        
<pattern>org.joda.time</pattern>
                                                                        
<shadedPattern>
@@ -772,6 +829,13 @@ under the License.
                                                                        
</shadedPattern>
                                                                </relocation>
                                                        </relocations>
+                                                       <transformers 
combine.children="append">
+                                                               <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                                                       
<manifestEntries>
+                                                                               
<Multi-Release>true</Multi-Release>
+                                                                       
</manifestEntries>
+                                                               </transformer>
+                                                       </transformers>
                                                </configuration>
                                        </execution>
                                </executions>
diff --git a/flink-rpc/flink-rpc-akka/pom.xml b/flink-rpc/flink-rpc-akka/pom.xml
index 4e99f8d4291..b4b3177c201 100644
--- a/flink-rpc/flink-rpc-akka/pom.xml
+++ b/flink-rpc/flink-rpc-akka/pom.xml
@@ -190,6 +190,8 @@ under the License.
                                                                                
<!-- Only parts of NOTICE file actually apply to the netty JAR and have been 
manually
                                                                                
         copied into this modules's NOTICE file. -->
                                                                                
<exclude>META-INF/NOTICE.txt</exclude>
+                                                                               
<!-- Drop stale JPMS descriptor; after relocation it points at packages that no 
longer exist. -->
+                                                                               
<exclude>META-INF/**/module-info.class</exclude>
                                                                        
</excludes>
                                                                </filter>
                                                                <filter>

Reply via email to