Fix #12991: skip shade-plugin upgrade when custom ResourceTransformers are present - #12997
Conversation
gnodet
left a comment
There was a problem hiding this comment.
Well-implemented bug fix that follows the established Quarkus plugin skip pattern. Custom ResourceTransformer detection is correct and conservatively prevents build breakage.
Two areas could be improved:
-
Missing log on effective-model path (medium): When
hasCustomTransformersInAnyPom()returns true and shade-plugin is silently removed frompluginUpgradesinanalyzePluginsUsingEffectiveModels(), no log message is emitted. The direct-upgrade path correctly warns viacontext.warning("Skipping maven-shade-plugin upgrade..."), but the effective-model path (for shade-plugin inherited from a remote parent) is silent. Adding acontext.warning()afterpluginUpgrades.remove(shadePluginKey)would close this feedback gap. -
Project-wide exclusion in multi-module builds (medium):
hasCustomTransformersInAnyPom()checks ALL POMs in the project. In a multi-module build where only one module uses custom transformers, shade-plugin upgrade is skipped for every module via the effective-model path. This is safe but overly conservative — a per-module check would allow upgrading shade-plugin in modules that only use standard transformers.
Strengths:
- Thorough test coverage (11 tests covering all combinations)
- Clean single-commit structure with proper issue reference
- Mirrors the established Quarkus plugin skip pattern correctly
🔀 Backport Status
master but no backport to maven-4.0.x was found. The maven-4.0.x branch has the shade-plugin upgrade entry but lacks the custom transformer detection. Branches maven-3.9.x and maven-3.10.x do not contain mvnup.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
| } | ||
|
|
||
| for (Map.Entry<Path, Document> entry : pomMap.entrySet()) { | ||
| Path originalPomPath = entry.getKey(); |
There was a problem hiding this 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:
context.warning("Skipping maven-shade-plugin in effective-model analysis: "
+ "custom ResourceTransformer(s) found in project POMs");…s are present mvnup now detects custom (non-standard) ResourceTransformer implementation classes in maven-shade-plugin configuration and skips the version upgrade when they are found. Custom transformers may depend on transitive dependencies (e.g. org.jdom:jdom) that are no longer present in newer shade-plugin versions, silently breaking the build. The check inspects both top-level <configuration> and per-execution <configuration> blocks for <transformer> elements whose implementation attribute does not start with org.apache.maven.plugins.shade.resource. When custom transformers are detected, a warning is emitted advising manual upgrade after verifying compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… path - Add context.warning() when shade-plugin is skipped in effective-model analysis, closing the feedback gap with the direct-upgrade path - Replace project-wide hasCustomTransformersInAnyPom() with per-module hasCustomTransformersInPomOrParents() that walks the local parent chain, so unrelated modules in a multi-module build can still have their shade-plugin upgraded Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2ba3672 to
282d69f
Compare
…s are present Backport of #12997 to maven-4.0.x. mvnup detects custom ResourceTransformer classes in shade-plugin configuration and skips the upgrade when found. Per-module check in multi-module builds — unaffected modules can still be upgraded. Warning logged with the list of custom transformers found. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
ResourceTransformerimplementations inmaven-shade-pluginconfiguration before upgrading the plugin versionProblem
mvnupupgradesmaven-shade-pluginfrom old versions (e.g. 1.3.3) to 3.5.0 for Maven 4 compatibility. However, projects using customResourceTransformerimplementations (e.g.BeansXmlTransformerin myfaces-extcdi) may depend on transitive dependencies likeorg.jdom:jdomthat were available in old shade-plugin versions but removed in newer ones. The upgrade silently breaks these projects.Solution
Added detection logic (following the existing Quarkus plugin skip pattern) that inspects
<configuration>/<transformers>/<transformer implementation="...">elements in both top-level and per-execution configurations. Transformers whoseimplementationclass does not start withorg.apache.maven.plugins.shade.resource.are considered custom. When found, the upgrade is skipped with a warning message advising manual upgrade.Test plan
PluginUpgradeShadeTestcovering all scenariosfindCustomTransformerClassesmethodPluginUpgradeStrategyTesttests passPluginUpgradeQuarkusTesttests pass🤖 Generated with Claude Code