question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add OSGi headers to MANIFEST.MF

See original GitHub issue

Apache Karaf (and other OSGi runtimes) that use log4j2 will need the lmax release to include the OSGi header data.

The bnd gradle plugin (v5.3.0) should have no problem auto-generating the correct headers, since the disruptor packaging is straightforward.

I’d create a PR, but am unfamiliar with gradle.

Gradle BND plugin

Sample OSGi metadata from LMAX disruptor 3.4.2

Bundle-Description = Disruptor - Concurrent Programming Framework
Bundle-DocURL = http://lmax-exchange.github.com/disruptor
Bundle-ManifestVersion = 2
Bundle-Name = Disruptor Framework
Bundle-SymbolicName = com.lmax.disruptor
Bundle-Vendor = LMAX Disruptor Development Team
Bundle-Version = 3.4.2

Require-Capability = 
	osgi.ee;filter:=(&(osgi.ee=JavaSE)(version=1.7))

Export-Package = 
	com.lmax.disruptor;uses:=com.lmax.disruptor.dsl;version=3.4.2,
	com.lmax.disruptor.dsl;uses:=com.lmax.disruptor;version=3.4.2,
	com.lmax.disruptor.util;uses:="com.lmax.disruptor,sun.misc";version=3.4.2
Import-Package = 
	com.lmax.disruptor;version="[3.4,4)",
	com.lmax.disruptor.dsl;version="[3.4,4)",
	com.lmax.disruptor.util;version="[3.4,4)",
	sun.misc

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mattrpavcommented, Sep 15, 2021

@Palmr thanks!

1reaction
mattrpavcommented, Sep 2, 2021

The fix:

     manifest.attributes('Built-By': System.properties.get('user.name'),
             'Automatic-Module-Name': moduleName)
     bnd(
-            '-exportcontents': 'com.lmax.disruptor.*',
-            '-includepackage': 'com.lmax.disruptor.*',
+           '-exportcontents': 'com.lmax.disruptor.*;-noimport:=true',
+            '-noimportjava': 'true',
+            'Import-Package': '!*',
             'Bundle-Name': fullName,
             'Bundle-Vendor': teamName,
             'Bundle-Description': fullDescription,
             'Bundle-DocURL': siteUrl,
-            'Bundle-SymbolicName': moduleName,
+            'Bundle-SymbolicName': moduleName
     )
 }

Generates correct MANIFEST:

Manifest-Version: 1.0
Automatic-Module-Name: com.lmax.disruptor
Bnd-LastModified: 1630598500367
Built-By: mattrpav
Bundle-Description: Disruptor - Concurrent Programming Framework
Bundle-DocURL: https://lmax-exchange.github.io/disruptor
Bundle-ManifestVersion: 2
Bundle-Name: Disruptor Framework
Bundle-SymbolicName: com.lmax.disruptor
Bundle-Vendor: LMAX Disruptor Development Team
Bundle-Version: 4.0.0.SNAPSHOT
Created-By: 11.0.11 (Oracle Corporation)
Export-Package: com.lmax.disruptor;uses:="com.lmax.disruptor.dsl";vers
 ion="4.0.0",com.lmax.disruptor.dsl;uses:="com.lmax.disruptor";version
 ="4.0.0",com.lmax.disruptor.util;uses:="com.lmax.disruptor";version="
 4.0.0"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=11))"
Tool: Bnd-5.3.0.202102221516
Read more comments on GitHub >

github_iconTop Results From Across the Web

Example: OSGi bundle manifest file - IBM
An OSGi bundle, which can be a JAR or web application archive (WAR) file, contains a bundle manifest file META-INF/MANIFEST.MF. In addition to...
Read more >
Appendix A. OSGi manifest headers - OSGi in Depth
Manifest header entries are very significant in OSGi as they dictate behavior for several OSGi services and framework features. The following table includes ......
Read more >
OSGi Bundle MANIFEST Headers - Liferay Savvy
We can use many standard OSGi bundle headers in bundle MANIFEST file. Each header have their own significant meaning. Bundle header and its ......
Read more >
how to add Service-Component header to the bundle manifest ...
I am using maven-bundle-plugin to build the osgi bundle , any instructions i can give in the plugin configuration that will add such...
Read more >
OSGi Bundle Manifest Headers - Products & Platforms
A bundle can carry descriptive information about itself in the manifest file named META-INF/MANIFEST.MF. The OSGi R7 Framework specification ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found