gnodet commented on code in PR #12997:
URL: https://github.com/apache/maven/pull/12997#discussion_r3904159411


##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategy.java:
##########
@@ -656,6 +672,15 @@ private PluginAnalysisResults 
analyzePluginsUsingEffectiveModels(
         Map<Path, Set<String>> directOverrideResult = new HashMap<>();
         Map<String, PluginUpgrade> pluginUpgrades = getPluginUpgradesAsMap();
 
+        // Pre-check: if any local POM has shade-plugin with custom 
transformers,
+        // exclude it from effective model upgrades to avoid breaking the build
+        String shadePluginKey = DEFAULT_MAVEN_PLUGIN_GROUP_ID + 
":maven-shade-plugin";
+        boolean shadeHasCustomTransformers = 
hasCustomTransformersInAnyPom(pomMap);
+        if (shadeHasCustomTransformers) {
+            pluginUpgrades = new HashMap<>(pluginUpgrades);
+            pluginUpgrades.remove(shadePluginKey);
+        }
+
         for (Map.Entry<Path, Document> entry : pomMap.entrySet()) {
             Path originalPomPath = entry.getKey();

Review Comment:
   When shade-plugin is removed here because custom transformers were detected, 
no log message is emitted. The direct-upgrade path in `upgradePluginVersion()` 
correctly warns the user, but this effective-model path is silent. Consider 
adding:
   ```java
   context.warning("Skipping maven-shade-plugin in effective-model analysis: "
           + "custom ResourceTransformer(s) found in project POMs");
   ```



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