Prev Next

Adding Extra Packages

The -conditionalpackage instruction has given us a nice way to ensure that we’ve covered all package dependencies that are discoverable by code inspection. However, in certain cases there are resources that must be included. Unfortunately, bnd has no knowledge of those references. It is therefore necessary to copy those resources.

For example, when we inspect the list of included packages (you can see them with the JAR Editor) we find that for the pull-parser__pull-parser-2.1.10.jar we only drag in one package org.gjt.xpp:

...
org/dom4j/xpp
  ProxyXmlStartTag.class
org/gjt
org/gjt/xpp
  XmlEndTag.class
  XmlFormatter.class
  XmlNode.class
  XmlPullNode.class
  XmlPullParser.class
  XmlPullParserBufferControl.class
  XmlPullParserEventPosition.class
  XmlPullParserException.class
  XmlPullParserFactory.class
  XmlRecorder.class
  XmlStartTag.class
  XmlTag.class
  XmlWritable.class
org/relaxng
org/relaxng/datatype
...

This implies we do not carry the implementation, this is just the API. So we can add the implementation using the following instruction:

Private-Package: org.gjt.xpp.*

If we now look in our bundle then we see:

...
org/dom4j/xpp
  ProxyXmlStartTag.class
org/gjt
org/gjt/xpp
  XmlEndTag.class
  XmlFormatter.class
  XmlNode.class
  XmlPullNode.class
  XmlPullParser.class
  XmlPullParserBufferControl.class
  XmlPullParserEventPosition.class
  XmlPullParserException.class
  XmlPullParserFactory.class
  XmlRecorder.class
  XmlStartTag.class
  XmlTag.class
  XmlWritable.class
org/gjt/xpp/impl
  PullParserFactoryFullImpl.class
org/gjt/xpp/impl/format
  Formatter.class
  Recorder.class
org/gjt/xpp/impl/node
  EmptyEnumerator.class
  Node.class
  OneChildEnumerator.class
org/gjt/xpp/impl/pullnode
  PullNode.class
  PullNodeEnumerator.class
org/gjt/xpp/impl/pullparser
  ElementContent.class
  PullParser.class
org/gjt/xpp/impl/tag
  Attribute.class
  EndTag.class
  PullParserRuntimeException.class
  StartTag.class
  Tag.class
org/gjt/xpp/impl/tokenizer
  Tokenizer.class
  TokenizerBufferOverflowException.class
  TokenizerException.class
org/relaxng
org/relaxng/datatype
...

It should be clear that this could add additional imports so we should verify the Contents tab. Fortunately in this case we add a few additional packages form the external dependency jaxen bundle, no problem here.


Prev Next