I'm having trouble getting an OSGi bundle loaded into a third party framework. It keeps rejecting my bundle because I am specifying Import-Package versions that do not exist, even though I know they are loading the bundles with the versions I want/need. To get around the problem, I have temporarily disabled my version requirements, but it is a little ugly.
Import-Package: com.ghc.ghTester.expressions,org.apache.ws.security;vers
ion=0,org.apache.ws.security.components.crypto;version=0,org.apache.ws.
security.message;version=0,org.apache.ws.security.message.token;version
=0,org.apache.ws.security.processor;version=0
When I look at the Manifest for my dependency, I see:
Bundle-Version: 1.5.11
Bundle-ClassPath: wss4j-1.5.11.jar
Bundle-Vendor: Apache
Export-Package: org.apache.ws.axis.security,
org.apache.ws.axis.security.handler,
org.apache.ws.security,
org.apache.ws.security.action,
org.apache.ws.security.components.crypto,
org.apache.ws.security.conversation,
org.apache.ws.security.conversation.dkalgo,
org.apache.ws.security.handler,
org.apache.ws.security.message,
org.apache.ws.security.message.token,
org.apache.ws.security.processor,
org.apache.ws.security.saml,
org.apache.ws.security.transform,
org.apache.ws.security.util
After complaining to the Framework team, they have told me that I need to use bundle-version
and not version
in my Import-Package
statement, such as:
Import-Pacakge: org.apache.ws.security;bundle-version=[1.5.0,2)
I've read through the OSGi Specs (page 50), but cannot seem to understand the nuance between these two values:
The developer can specify arbitrary matching attributes. See Attribute Matching on page 58. The following arbitrary matching attributes are predefined:
• version - A version-range to select the exporter's package version. The syntax must follow Version Ranges on page 36. For more information on version selection, see Semantic Versioning on page 54. If this attribute is not specified, it is assumed to be [0.0.0, ∞).
• specification-version - This attribute is an alias of the version attribute only to ease migration from earlier versions. If the version attribute is present, the values must be equal.
• bundle-symbolic-name - The bundle symbolic name of the exporting bundle. In the case of a fragment bundle, this will be the host bundle's symbolic name.
• bundle-version - A version-range to select the bundle version of the exporting bundle. The default value is [0.0.0, ∞). See Semantic Versioning on page 54. In the case of a fragment bundle, the version is from the host bundle.
Can someone please clarify the difference between the version
and the bundle-version
? From the way I read the docs, the bundle-version (ie: the manifest's Bundle-Version
) would extend to all packages in the bundle. So wouldn't the package version (ie: version) be the same as the bundle-version (ie: bundle-version) on the Import-Package
statement? Why is there an ability to specify the two differently?