Java Reference
In-Depth Information
This instruction ( http://aqute.biz/Code/Bnd#versionpolicy ) tells bnd to take the
detected version ${@} and turn it into a range containing the current major.minor ver-
sion ${version;==;...} up to but not including the next major version ${version;
+;...} . (See appendix A for more information about the various bnd instructions.)
So if the bnd tool knows that a package has a version of 4.1.8, it applies a version range
of [4.1,5) to any import of that package. You add this to each of your bnd files (you
can also put it in a shared common file) along with the changes to export the neces-
sary packages.
Following are the final bnd instructions for the jEdit third-party library bundle:
-output: jedit-thirdparty.jar
Bundle-Name: jEdit Third-party Libraries
Bundle-SymbolicName: org.gjt.sp.jedit.libs
Bundle-Version: 4.2
Export-Package: bsh, com.microstar.xml, gnu.regexp
Private-Package: !org.gjt.sp.*, !installer.*, *
-versionpolicy: [${version;==;${@}},${version;+;${@}})
And here are the final bnd instructions for the jEdit engine bundle:
-output: jedit-engine.jar
Bundle-Name: jEdit Engine
Bundle-SymbolicName: org.gjt.sp.jedit.engine
Bundle-Version: 4.2
Export-Package:\
!org.gjt.sp.jedit,\
!org.gjt.sp.jedit.proto.*,\
org.gjt.sp.*;version="4.2"
-versionpolicy: [${version;==;${@}},${version;+;${@}})
You still have one more (non- OSG i) tweak to make to the main jEdit bundle instruc-
tions. Remember that you now create three JAR files in place of the original single JAR
file. Although you can rely on the OSG i framework to piece these together into a sin-
gle application at execution time, this isn't true of the standard Java launcher. You
need some way to tell it to include the two additional JAR files on the class path when-
ever someone executes:
$ java -jar jedit.jar
Thankfully, there is a way: you need to add the standard Class-Path header to the
main JAR file manifest. The Class-Path header takes a space-separated list of JAR files,
whose locations are relative to the main JAR file. These final main-bundle instructions
allow jEdit to work both as a bundle and an executable JAR :
-output: jedit.jar
-include: org/gjt/sp/jedit/jedit.manifest
Class-Path: jedit-thirdparty.jar jedit-engine.jar
 
Search WWH ::




Custom Search