gyfora commented on code in PR #1105:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/1105#discussion_r3356451665


##########
flink-kubernetes-operator/pom.xml:
##########
@@ -268,17 +284,154 @@ under the License.
                         </goals>
                         <configuration>
                             
<shadedArtifactAttached>true</shadedArtifactAttached>
+                            <!--
+                                The non-shaded JAR is the main artifact 
(consumers like
+                                flink-kubernetes-webhook compile against it as 
a regular
+                                Maven dep). Shade still tries to publish a
+                                dependency-reduced-pom.xml that pretends every 
dep was
+                                absorbed into the shaded fat-JAR, which strips 
compile-scope
+                                deps (flink-core, slf4j, fabric8, jackson, …) 
from the
+                                installed pom and breaks downstream 
compilation. Disable
+                                pom reduction so the original pom — with the 
full dep tree —
+                                is the one published / installed for this 
artifact.
+                            -->
+                            
<createDependencyReducedPom>false</createDependencyReducedPom>
                             <filters combine.children="append">
                                 <filter>
                                     <artifact>*:*</artifact>
                                     <excludes>
+                                        <!-- JPMS module descriptors: the 
uber-JAR is not modular,
+                                        so these are meaningless and only 
cause shade's
+                                        "Discovered module-info.class …" 
warnings. -->
+                                        <exclude>module-info.class</exclude>
                                         
<exclude>META-INF/**/module-info.class</exclude>
+                                        <!-- Signature files of signed input 
jars: keeping them
+                                        in an uber-JAR triggers 
SecurityException at runtime. -->
+                                        <exclude>META-INF/*.SF</exclude>
+                                        <exclude>META-INF/*.DSA</exclude>
+                                        <exclude>META-INF/*.RSA</exclude>
+                                        <!-- Per-dependency Maven build 
metadata: pom.xml /
+                                        pom.properties shipped under 
META-INF/maven/ are only
+                                        used to identify the original dep, not 
at runtime. -->
+                                        <exclude>META-INF/maven/**</exclude>
+                                        <!-- Per-dependency 
LICENSE/NOTICE/DEPENDENCIES files.
+                                        NOTICE is already aggregated by the 
parent pom's
+                                        ApacheNoticeResourceTransformer; the 
project's
+                                        top-level LICENSE / NOTICE / licenses/ 
directory is the
+                                        canonical attribution and is shipped 
at the repo root. -->
+                                        
<exclude>META-INF/DEPENDENCIES</exclude>
+                                        <exclude>META-INF/LICENSE</exclude>
+                                        <exclude>META-INF/LICENSE.txt</exclude>
+                                        <exclude>META-INF/license.txt</exclude>
+                                        <exclude>META-INF/NOTICE</exclude>
+                                        <exclude>META-INF/NOTICE.txt</exclude>
+                                        <exclude>META-INF/licenses/**</exclude>
+                                        <!-- Kotlin compilation metadata: only 
used by kotlinc
+                                        for cross-module compilation; 
irrelevant at runtime. -->
+                                        
<exclude>META-INF/*.kotlin_module</exclude>
+                                        <!-- ProGuard rules shipped by some 
libs (e.g. Guava):
+                                        only consumed by ProGuard, irrelevant 
in this uber-JAR. -->
+                                        <exclude>META-INF/proguard/**</exclude>
+                                        <!-- GraalVM native-image hints: only 
consumed by the
+                                        native-image build; this uber-JAR runs 
on the JVM. -->
+                                        
<exclude>META-INF/native-image/**</exclude>
+                                        <!-- Quarkus jandex pre-computed 
annotation indexes
+                                        shipped by the fabric8 kubernetes-* 
jars; not needed. -->
+                                        <exclude>META-INF/jandex.idx</exclude>
+                                        <!-- Netty release metadata; 
flink-shaded-netty wins on
+                                        overlap with 
flink-shaded-zookeeper-3's bundled netty. -->
+                                        
<exclude>META-INF/io.netty.versions.properties</exclude>
+                                        <!-- A fresh manifest is produced by 
the
+                                        ManifestResourceTransformer below, so 
dropping the inputs
+                                        avoids shade's "META-INF/MANIFEST.MF" 
overlap warning. -->
+                                        <exclude>META-INF/MANIFEST.MF</exclude>
                                     </excludes>
                                 </filter>
                                 <filter>
                                     
<artifact>org.apache.flink:flink-kubernetes</artifact>
                                     <excludes>
                                         
<exclude>META-INF/versions/**/com/fasterxml/jackson/core/io/doubleparser/**</exclude>
+                                        <!--
+                                            FlinkConfMountDecorator is 
intentionally forked under
+                                            flink-kubernetes-operator's source 
tree
+                                            
(org.apache.flink.kubernetes.kubeclient.decorators)
+                                            to override the version shipped by 
flink-kubernetes.
+                                            Drop the upstream copy so the fork 
deterministically
+                                            wins, silencing shade's 
"overlapping classes" warning.
+                                        -->
+                                        
<exclude>org/apache/flink/kubernetes/kubeclient/decorators/FlinkConfMountDecorator.class</exclude>
+                                    </excludes>
+                                </filter>
+                                <filter>
+                                    <!--
+                                        flink-autoscaler / 
flink-kubernetes-operator(-api) /
+                                        flink-autoscaler-standalone all ship 
intentional forks of
+                                        a handful of 
org.apache.flink.runtime.rest.messages.*
+                                        classes (see e.g.
+                                        
flink-kubernetes-operator/src/main/java/org/apache/flink/runtime/rest/messages/
+                                        and 
flink-autoscaler/src/main/java/org/apache/flink/runtime/rest/messages/).
+                                        Drop the upstream copies from 
flink-runtime so the local
+                                        forks deterministically win, silencing 
shade's
+                                        "overlapping classes" warnings.
+                                    -->
+                                    
<artifact>org.apache.flink:flink-runtime</artifact>
+                                    <excludes>

Review Comment:
   I am not sure if it's a good idea to enumerate and exclude the overlapping 
classes this way. When the overlapping classes are removed from the operator 
this will silently break the output uber jar. Maybe the warning is better than 
that scenario :) 



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