OSGi: export a package without exporting multiple classes in one package

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

+5
source share
1 answer

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.

+3
source

Source: https://habr.com/ru/post/1200346/