Osgi eclipse: how to export a package from a package of fragments and make them visible to an external package?

Starter Status (no errors):

  • I have three different packages: bunbdle A (called org.apache.xmlbeans), bundle B, and package C
  • package B imports some packages exported from package A
  • package B exports some packages (e.g. package com.prova.xsd.config)
  • package C imports packages exported by package B (for example, package com.prova.xsd.config)

Now I am making bundle B a fragment of bundle A (host fragment) by adding the directive Fragment-Host: org.apache.xmlbeans to MANIFEST of package B

After this change in MANIFEST.MF of all bundles (A, B, C) there are no errors, but in the .java classes of package C I have a compilation error: "Import com.prova.xsd.config cannot be resolved" related to import into chapter of the .java file.

What is the problem? How can i fix this?

Many thanks,

Andrea

+4
source share
1 answer

You need to add "Eclipse-ExtensibleAPI: true" to the manifest of your host plugin A.

From Eclipse Help: OSGi Manifest Package :

Eclipse-ExtensibleAPI Header

Eclipse-ExtensibleAPI , API . , - API . , 'false'. , (PDE) . . , API API . Eclipse-ExtensibleAPI :

Eclipse-ExtensibleAPI ::= ( 'true' | 'false' )

Eclipse-ExtensibleAPI:

Eclipse-ExtensibleAPI: true
+3

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


All Articles