Search code examples
osgiosgi-bundle

OSGI export package


I need to import a package A for my projects. However, the import can't be resolved. So I looked into the export package file from the package I need.

I am using Equinox, spring, and maven. All following code is inside the pom.xml file.

// E.D.C.B.A

!E.D.C.B.F*
!E.D.C.B.G*
!E.D.C.B.Z*
E.D.C.B*,
!*

This question could be narrowed down to two simple questions.

  1. Does E.D.C.B* include E.D.C.B?
  2. what does !* mean? Does it mean exports no packages or export no package expect those are specified?

For my understanding, I think the code above means export no package expect those are specified. All packages in E.D.C.B* (like E.D.C.B and E.D.C.Bbdfd) are allowed except those in E.D.C.B.F*, E.D.C.B.G* and E.D.C.B.G*.


Solution

  • Answering your questions:

    I am assuming you are talking about the Export-Package instruction from the Apache Felix maven-bundle-plugin. If this is not correct, please be more specific.

    1. Yes, E.D.C.B* will export package E.D.C.B and sub-packages.
    2. !* usually is not needed if you're already specifying the packages that you intend to export before, but generally means: not (any package)

    Your final understanding is correct in this case.

    Also note that instructions are processed in-order, so that exclusions or inclusions specified first take precedence over following declarations, which is why !* does not make any sense, actually.