Search code examples
osgiosgi-bundlemaven-bundle-plugin

OSGi:export a package without exporting a few Classes within the same package


I am working in a OSGi project where we need to export a package in bundle but we do not want to export a two specific class of this bundle. To give more background, we use a third party jar that is not osgi bundle so we add this as a part of OSGi bundle and in this third party jar we need to export a package "A" but this package A has two specific classes that we do not intend to be exported. Please give your suggestion on the way to achieve this.


Solution

  • Export-Package: some.package.name; version=1.0; exclude:="ClassA,ClassB"

    See sections 3.6.5 and 3.7.9 in the OSGi Core specification.