Skip to content

Conversation

laeubi
Copy link

@laeubi laeubi commented Oct 2, 2025

This pull request adds OSGi metadata support to the Java package and updates the Maven parent version. The main focus is on improving Java module compatibility with OSGi environments by updating the build configuration.

Java build and packaging improvements:

  • Added the bnd-maven-plugin to pom.xml to generate OSGi metadata, enabling better integration with OSGi-based systems.
  • Updated the maven-jar-plugin configuration in pom.xml to specify the manifest file location, which is necessary for proper OSGi metadata inclusion.
  • Bumped the Maven parent version from 4.3.8 to 4.3.9 in pom.xml to ensure compatibility with the new plugins and features.

Documentation:

  • Updated the CHANGELOG.md to document the addition of OSGi metadata for Java.This pull request adds support for OSGi metadata to the Java build, making the project more compatible with OSGi-based environments. The main changes involve updating the Maven build configuration and documenting the addition.

Build system enhancements:

  • Added the bnd-maven-plugin and configured the maven-jar-plugin in pom.xml to generate OSGi metadata in the build artifacts.
  • Updated the parent version in pom.xml to 4.3.9-SNAPSHOT to reflect the ongoing development state.

Documentation:

  • Noted the addition of OSGi metadata in the CHANGELOG.md under the "Added" section.

This results in the following summary:

[INFO] The Bundle-SymbolicName is: io.cucumber.messages
[INFO] 29.0.2.SNAPSHOT
[INFO] It has 5 requirements:
[INFO]  ✓ Import-Package: java.io (provided by the JVM)
[INFO]  ✓ Import-Package: java.lang (provided by the JVM)
[INFO]  ✓ Import-Package: java.nio.charset (provided by the JVM)
[INFO]  ✓ Import-Package: java.time (provided by the JVM)
[INFO]  ✓ Import-Package: java.util (provided by the JVM)
[INFO] It provides 2 capabilities:
[INFO]  - Export-Package: io.cucumber.messages; bundle-symbolic-name="io.cucumber.messages"; bundle-version="29.0.2.SNAPSHOT"; version="29.0.2"; uses:="io.cucumber.messages.types"
[INFO]  - Export-Package: io.cucumber.messages.types; bundle-symbolic-name="io.cucumber.messages"; bundle-version="29.0.2.SNAPSHOT"; version="29.0.2"

And the final manifest in the jar looks like this:

Manifest-Version: 1.0
Created-By: Maven JAR Plugin 3.4.2
Build-Jdk-Spec: 21
Specification-Title: Cucumber Messages
Specification-Version: 29.0
Implementation-Title: Cucumber Messages
Implementation-Version: 29.0.2-SNAPSHOT
Automatic-Module-Name: io.cucumber.messages
Bundle-Description: JSON schema-based messages for Cucumber's inter-proc
 ess communication
Bundle-Developers: cucumber;email="[email protected]";name="Cucumber Deve
 lopers";organization=Cucumber;organizationUrl="https://github.com/cucum
 ber"
Bundle-DocURL: https://github.com/cucumber/messages
Bundle-License: "MIT License";link="https://www.opensource.org/licenses/
 mit-license"
Bundle-ManifestVersion: 2
Bundle-Name: Cucumber Messages
Bundle-SCM: url="git://github.com/cucumber/messages.git",connection="scm
 :git:git://github.com/cucumber/messages.git",developer-connection="scm:
 git:[email protected]:cucumber/messages.git",tag=HEAD
Bundle-SymbolicName: io.cucumber.messages
Bundle-Version: 29.0.2.SNAPSHOT
Export-Package: io.cucumber.messages;uses:="io.cucumber.messages.types";
 version="29.0.2",io.cucumber.messages.types;version="29.0.2"
Import-Package: java.io,java.lang,java.nio.charset,java.time,java.util
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"

@mpkorstanje for me it all looks sane, can you review this?

Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please do add a link to this PR in the changelog.

@laeubi laeubi force-pushed the add_osgi_metadata branch from 5e60ebb to 101a87a Compare October 2, 2025 10:45
@mpkorstanje
Copy link
Contributor

Import-Package: java.io,java.lang,java.nio.charset,java.time,java.util
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"

Just thought of something. But I don't know OSGI that well.

Are these module imports? If so, then the JavaSe version shouldn't be 1.8.

@laeubi
Copy link
Author

laeubi commented Oct 2, 2025

Are these module imports?

No these are packages

If so, then the JavaSe version shouldn't be 1.8.

The project is currently compiled with Java 1.8 bytecode that's why 1.8 is used here as the minimum version.

@laeubi laeubi force-pushed the add_osgi_metadata branch from 101a87a to 243d853 Compare October 3, 2025 18:55
@laeubi laeubi marked this pull request as ready for review October 3, 2025 18:57
@laeubi
Copy link
Author

laeubi commented Oct 3, 2025

@mpkorstanje rebased to use the new parent, build should now succeed

Final outcome is:

[INFO] The Bundle-SymbolicName is: io.cucumber.messages
[INFO] 30.0.1.SNAPSHOT
[INFO] It has 5 requirements:
[INFO]  ✓ Import-Package: java.io (provided by the JVM)
[INFO]  ✓ Import-Package: java.lang (provided by the JVM)
[INFO]  ✓ Import-Package: java.nio.charset (provided by the JVM)
[INFO]  ✓ Import-Package: java.time (provided by the JVM)
[INFO]  ✓ Import-Package: java.util (provided by the JVM)
[INFO] It provides 2 capabilities:
[INFO]  - Export-Package: io.cucumber.messages; bundle-symbolic-name="io.cucumber.messages"; bundle-version="30.0.1.SNAPSHOT"; version="30.0.1"; uses:="io.cucumber.messages.types"
[INFO]  - Export-Package: io.cucumber.messages.types; bundle-symbolic-name="io.cucumber.messages"; bundle-version="30.0.1.SNAPSHOT"; version="30.0.1"

Manifest:

Manifest-Version: 1.0
Created-By: Maven JAR Plugin 3.4.2
Build-Jdk-Spec: 21
Specification-Title: Cucumber Messages
Specification-Version: 30.0
Implementation-Title: Cucumber Messages
Implementation-Version: 30.0.1-SNAPSHOT
Automatic-Module-Name: io.cucumber.messages
Bundle-Description: JSON schema-based messages for Cucumber's inter-proc
 ess communication
Bundle-Developers: cucumber;email="[email protected]";name="Cucumber Deve
 lopers";organization=Cucumber;organizationUrl="https://github.com/cucum
 ber"
Bundle-DocURL: https://github.com/cucumber/messages
Bundle-License: "MIT License";link="https://www.opensource.org/licenses/
 mit-license"
Bundle-ManifestVersion: 2
Bundle-Name: Cucumber Messages
Bundle-SCM: url="git://github.com/cucumber/messages.git",connection="scm
 :git:git://github.com/cucumber/messages.git",developer-connection="scm:
 git:[email protected]:cucumber/messages.git",tag=HEAD
Bundle-SymbolicName: io.cucumber.messages
Bundle-Version: 30.0.1.SNAPSHOT
Export-Package: io.cucumber.messages;uses:="io.cucumber.messages.types";
 version="30.0.1",io.cucumber.messages.types;version="30.0.1"
Import-Package: java.io,java.lang,java.nio.charset,java.time,java.util
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"

if this is merged and released I will continue with the dependent gherkin / gherkin-util.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants