Java Reference
In-Depth Information
First, comment out the jar task:
<!-- jar jarfile="jedit.jar"
</jar -->
The first line above shows where to put the JAR file, and the second lists fixed manifest
Next, add the bnd definition and target task:
<taskdef resource="aQute/bnd/ant/"
classpath="../../../lib/bnd-0.0.384.jar" />
<bnd classpath="${}"
files="jedit-mega.bnd" />
Here, you first give the location of the bnd JAR file to tell Ant where it can find the
bnd task definition. Then you specify a bnd task to create your bundle JAR file, giving
it the project class path and the file containing your bnd instructions.
There's one key difference between the jar and bnd tasks that you must remember:
The jar task takes a list of files and directories and copies them all into a single
JAR file.
The bnd task takes a class path and a list of instruction files (one file per bun-
dle) that tell it which classes and/or resources to copy from the class path into
each bundle.
If you don't tell bnd to pull a certain package into the bundle, don't be surprised if
the package isn't there. You're building a single mega bundle, so you need only one
instruction file: call it jedit-mega.bnd. The first thing you must add is an instruction to
tell bnd where to put the generated bundle:
-output: jedit.jar
The bnd task can also copy additional manifest headers into the final manifest, so let's
ask bnd to include the original jEdit manifest rather than duplicate its content in your
new file:
-include: org/gjt/sp/jedit/jedit.manifest
You could have left the manifest file where it was, added your instructions to it, and
passed that into bnd, but this would make it harder for people to separate out the new
build process from the original. It's also better to have the bnd instructions at the
project root where they're more visible. You can now try to build the project from
inside the jEdit directory:
$ ant dist
[bnd] Warnings
[bnd] None of Export-Package, Private-Package, -testpackages, or -
exportcontents is set, therefore no packages will be included
Search WWH ::

Custom Search