Assistance w/ bnd gradle plugin

I’m working to assist the LMAX Disruptor team add OSGi headers back into their latest 4.0.0 release. I’m not familiar with gradle and require assistance.

The LMAX-Disruptor project uses gradle, and needs assistance configuring the gradle bundle plugin. Very simple jar. No external dependencies (JDK-only) and exports 3 packages.


import aQute.bnd.gradle.Bundle

tasks.register('bundle',  Bundle) {
  from sourceSets.main.output

I tried variations:

jar {
    bundle {
            'Export-Package': 'com.lmax.disruptor,com.lmax.disruptor.dsl,com.lmax.disruptor.util',
            'Import-Package': '!*'


jar {
    bundle {
             '-exportcontents': 'com.lmax.disruptor.*',
             '-includepackage': '!*'

Continue to generate this MANIFEST.MF:

Manifest-Version: 1.0
Bnd-LastModified: 1630595039939
Bundle-ManifestVersion: 2
Bundle-Name: disruptor
Bundle-SymbolicName: disruptor
Bundle-Version: 4.0.0.SNAPSHOT
Created-By: 11.0.11 (Oracle Corporation)
Import-Package: java.lang,java.lang.invoke,java.lang.reflect,java.secu
Private-Package: com.lmax.disruptor,com.lmax.disruptor.dsl,com.lmax.di
Tool: Bnd-

Assistance would be appreciated!

WIP lmax-osgi branch: GitHub - Palmr/disruptor at osgi

You seem to be using the latest release of Bnd which is 5.3.0. But you are using the syntax of the new, still under development, 6.0.0 release. The bundle extension is not present in 5.3.0. Don’t use it for 5.3.0.

You also create a bundle task but I am not sure why since you configure the jar task.

If you don’t want to import the java packages, you can add -noimportjava: true to the Bnd configuration.

1 Like

I think you want:

1 Like

Thanks! That was it.