gnodet opened a new pull request, #14167:
URL: https://github.com/apache/maven/pull/14167
## Summary
Skip `maven-bundle-plugin` upgrade when the current version is in the
bndlib 2.x era (< 3.0.0), to avoid breaking legacy OSGi projects.
## Root Cause
`PluginUpgradeStrategy` upgrades `maven-bundle-plugin` to 5.1.1
(bndlib 7.x) regardless of the current version. When the current version
is in the 2.x range (bndlib 2.x), this jumps across four bndlib major
versions (2→3→4→5→6→7), each of which introduced stricter OSGi header
validation.
Legacy projects (e.g. Apache ServiceMix bundles, last active 2015) have
OSGi headers that bndlib 2.x accepted but bndlib 7.x rejects, such as
empty or malformed `Bundle-NativeCode` values:
```
[ERROR] Bundle ... : Can not parse name from bundle native code header:
[ERROR] Error(s) found in bundle configuration
```
## Fix
Add a guard similar to the existing `maven-shade-plugin` (custom
transformers) and Quarkus plugin (platform version) guards:
- If the declared version is **below 3.0.0** (bndlib 2.x era): skip the
upgrade and emit a warning explaining the risk and an incremental path
(first upgrade to 3.x, verify the build, then upgrade to 5.1.1).
- If the declared version is **3.0.0 or above**: upgrade normally as
before (the user has already navigated the bndlib 2→3 transition).
The property-version case is also covered: if the version is specified
via a property, the property value is resolved before checking the guard.
## Tests
Five new unit tests in `PluginUpgradeStrategyTest`:
- Skip + warn from 2.3.7 (bndlib 2.x)
- Skip + warn from 2.4.0 (another bndlib 2.x variant)
- Normal upgrade from 3.5.0 → 5.1.1 (bndlib 3.x, safe)
- Normal upgrade from 4.2.1 → 5.1.1 (bndlib 5.x, safe)
- Skip from property `${bundle.plugin.version}=2.3.7`
Full test suite: 952 tests, 0 failures.
Fixes #14164
---
_Hermes Agent (Claude Sonnet 4.5) on behalf of Guillaume Nodet_
--
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]