Java Reference
In-Depth Information
Bundle-ManifestVersion: 2
Bundle-Name: Fancy Foods Chocolate Bundle
Bundle-SymbolicName: fancyfoods.department.chocolate
Bundle-Version: 1.0.0
Created-By: 1.6.0 (IBM Corporation)
Import-Package: fancyfoods.food;version="[1.0,1.1)",fancyfoods.offers;ve
rsion="[1.0,1.1)"
Private-Package: fancyfoods.chocolate
Tool: Bnd-1.44.0
We hope that the advantages of a tool like bnd are now obvious; although it certainly
isn't a zero-effort solution, it's considerably faster than building the manifest by hand.
The other big advantage that you get from a tool like bnd is that you don't need to
guess at the packages your bundle should import, or have to debug unpleasant Class-
NotFoundException errors on rarely used code paths. Bnd isn't your only option for
packaging JAR s as OSG i bundles, so let's take a look at some of the competition.
USING BUNDLOR
Bundlor ( http://www.springsource.org/bundlor ) is an open source tool developed
and maintained by SpringSource. Although Bundlor isn't as widely used in the com-
munity as bnd is, it's the tool used to generate OSG i bundles for open source JAR s in
the SpringSource Enterprise Bundle Repository. Bundlor is used for the same pur-
poses as bnd, and it's able to wrap existing JAR files or create manifests for code at
build time. As a result, it's equally good for this example.
Using Bundlor is remarkably similar to using bnd. It also has integration points for
Apache Ant and Apache Maven builds, but for this example you'll continue to use the
command line. Getting Bundlor to create a manifest is as simple as issuing the follow-
ing command (there are Windows and Linux scripts available):
bundlor.bat -i <path to jar>
Issuing this command, you'll see that the behavior for Bundlor is different from bnd's
(see figure 12.2).
Figure 12.2 The
output from Bundlor
Search WWH ::




Custom Search