Repository navigation
Conversation
16cb3b9 to
408a732
Compare
…-bundle-plugin (apache#14164) When upgrading maven-bundle-plugin to 5.1.1 (bndlib 7.x), every bndlib major version introduced stricter OSGi header validation. Projects with edge-case headers may encounter build failures after the upgrade. The upgrade is still applied — it is required to fix FELIX-6259 (ConcurrentModificationException on JDK 17+) — but a warning is emitted so users know to check their OSGi bundle headers if the build fails after the upgrade (e.g. empty Bundle-NativeCode values are no longer accepted by bndlib 7.x). Fixes apache#14164
408a732 to
2499a92
Compare
gnodet-bot
left a comment
There was a problem hiding this comment.
Fix is correct: warn-and-upgrade is the right approach (skipping would leave users on a version with a known ConcurrentModificationException on JDK 17+). One minor gap in test coverage. Also: the PR title says 'skip' but the code actually warns — suggest updating the title.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
…ion in property test - Comment and warning message incorrectly referenced 'bndlib 7.x' (5.1.1 uses bndlib 5.x; 7.x only arrived with plugin 6.0.0+) - Warning said 'spans multiple bndlib major versions' but the upgrade from 4.x to 5.x crosses only one major version boundary; reworded to 'one or more bndlib major version boundaries' which is accurate for all upgrade origins - shouldUpgradeBundlePluginFromPropertyWhenBndlib2x now verifies the warning is emitted (was missing; flagged by gnodet-bot review)
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — the previous finding is now fully addressed. ✅
The missing warning assertion in shouldUpgradeBundlePluginFromPropertyWhenBndlib2x has been added (verify(context.logger, atLeastOnce()).warn(...) now covers the property-based upgrade path), and the bndlib version references in the comment and warning message have been corrected ("one or more bndlib major version boundaries" is accurate for all upgrade origins).
No new issues in this follow-up commit. LGTM.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
The PluginUpgradeStrategyTest.java file exceeds the 2000-line limit (2005 lines) after adding bundle-plugin upgrade warning tests. Follow the same pattern as maven-impl to suppress this check. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Emit a warning when upgrading
maven-bundle-pluginto 5.1.1 (bndlib 5.x), so users know to check their OSGi bundle headers if the build fails after the upgrade.Background — why the upgrade was introduced
PluginUpgradeStrategyaddedmaven-bundle-plugin → 5.1.1in PR #13001 (Sept 2026) to fix a real breakage on JDK 17.0.13+:bndlib < 5.1.0has a bug inJar.putResource()— it modifies aTreeMapfrom inside its owncomputeIfAbsent()callback. JDK 17.0.13 backported stricter CME detection from JDK 21, so this now reliably throwsConcurrentModificationException. Since Maven 4 requires JDK 17+, every project using an old BND plugin breaks.Root Cause (this PR)
The upgrade from plugin 4.2.1 → 5.1.1 crosses one bndlib major version boundary (4.x → 5.x), which introduced stricter OSGi header validation. Projects with edge-case headers (e.g. empty
Bundle-NativeCode) that bndlib 4.x accepted may fail after the upgrade.The upgrade was applied silently with no indication of the validation change.
Fix
Emit a warning on every
maven-bundle-pluginupgrade explaining that the new version uses a different bndlib major version and what to do if the build fails:The upgrade itself is still applied — skipping it would leave the FELIX-6259 CME unfixed, which is worse than a header validation failure the user can fix. The warning is informational only.
Tests
5 new unit tests covering 2.3.7, 2.4.0, 3.5.0, 4.2.1, and a property-based version — all upgraded to 5.1.1 with a warning verified where relevant. 952 tests pass.
Fixes #14164
Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet