Use the Liberty feature manifest
file to declare which packages you want to share as an API or SPI with other applications and
features in the Liberty runtime
environment.
About this task
A package cannot be declared as an API or SPI unless it is exported by a bundle in the Liberty feature, by being listed in the
Export-Package header of the bundle manifest file.
Procedure
To specify API and SPI packages for a Liberty feature project, complete the following
steps:
-
From the Project Explorer view, open the feature manifest file for the Liberty feature project by double-clicking the
Manifest node in the project hierarchy, indicated by the manifest icon
().
- To make one or more API packages available to OSGi applications,
click Add in the IBM API Packages pane.
-
When you create your own Liberty
feature, you install it into the user product extension, and all the packages in your feature can be
accessed by any other feature that is installed into the user product extension. To make one or more
SPI packages available to features in other product extensions, click Add in
the IBM SPI Packages pane.
- (Optional) Specify the package version by selecting the
package, clicking Properties, and entering
the required value in the Version field.
- (Optional) For an API package, select the package type
from the Type list in the Properties dialog box.
The type can be one of the following values:
- spec - Indicates an API provided by a standard body, such as
javax.servlet
or org.osgi.framework
.
- ibm-api - Indicates a value-add API provided by IBM®.
- api - Indicates a user-defined API. This is the default value.
- third-party - Indicates an API that is visible, but not controlled by IBM. Typically, these are open source packages.
- internal - Indicates non-API packages that must be exposed to
applications for them to function. This might be used if Java™
code is bytecode enhanced, or weaved, to add references to internal code at run time.
Results
The package names are added to the IBM-API-Package
and IBM-SPI-Package
headers in the feature manifest
file. For more information on the headers in the feature manifest file for a Liberty feature, see Liberty feature manifest files.