Skip to content

mvnup: maven-bundle-plugin upgrade to 5.1.1 too aggressive for legacy OSGi projects (bndlib 2.x to 7.x breaking changes) #14164

In review

Description

@gnodet

Problem

When upgrading org.apache.felix:maven-bundle-plugin to 5.1.1 (the current mvnup target), the upgrade may span from very old versions (e.g. 2.3.7, 2.4.0) all the way to 5.1.1, crossing bndlib major versions 2.x to 3.x to 4.x to 5.x to 6.x to 7.x. Each major bndlib version introduced stricter OSGi header parsing.

Legacy OSGi projects (especially Apache ServiceMix bundles, last active 2015) contain OSGi bundle configurations that worked with bndlib 2.x but are rejected by bndlib 7.x with errors like:

[ERROR] Bundle ... : Can not parse name from bundle native code header:
[ERROR] Error(s) found in bundle configuration

Affected projects

  • apache/servicemix4-bundles (gnodet/maven4-testing #42049) — spring-test bundle has an empty/malformed Bundle-NativeCode header accepted by bndlib 2.x, rejected by bndlib 7.x

Root cause

The jump from maven-bundle-plugin:2.3.7 to 5.1.1 is equivalent to jumping from bndlib ~2.3 to bndlib 7.x. bndlib 7.x has significantly stricter OSGi header validation. Projects that relied on bndlib's lenient parsing now fail.

While the upgrade is necessary to fix FELIX-6259 (ConcurrentModificationException on JDK 17+, introduced in bndlib 2.x/3.x), the jump is too large for projects with custom/edge-case OSGi headers.

Expected behavior

mvnup should either:

  1. Apply a staged upgrade: first to 3.x (fixes FELIX-6259 with bndlib 3.x), then verify before jumping to 5.x, OR
  2. Add a sanity check: when upgrading from a very old version (< 3.0), warn about the large jump, OR
  3. At minimum, document in the upgrade output that large bundle-plugin version jumps may introduce bndlib header parsing regressions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions