Skip to content

Extend the target platform

Simon Templer edited this page Apr 3, 2017 · 3 revisions

The target definition file (platform/hale-platform.target) specifies which bundles are available in the development environment. If for some reason you need additional libraries as dependencies, the preferred way is that you add an update site (p2 repository) that contains the needed libraries.
For local testing you can also add local folders containing OSGi bundles to the target definition.

When you want to contribute to the HALE repository and need additional dependencies (and they are compatible to HALE’s license), you can add it to the build of the main HALE target platform on GitHub and file a pull request. Local testing you can do by building the update site locally and adding it to the target definition file instead of the version that is used there by default (make sure you remove the right one – there are a few update sites in the target definition).

We build our update sites with third party dependencies using bnd-platform – this could also be a viable option for you for creating an update site. Anyway, if you plan to extend the main HALE target platform, you should take a look at the documentation there on how to do it.

Embed libraries in bundles

In some cases including a library via the target platform poses a great problem, for instance because of OSGi dependency conflicts or library incompatibilities. In that case it may be a viable solution to package the required libraries inside the bundle that uses them. This approach should really only be used if integration with the target platform cannot be done with a reasonable effort.

One problem that this approach brings with it is that, when using these bundles in a normal Java environment, the embedded libraries are not loaded. To work around that the hale build supports specifying additional Maven dependencies in the manifest file, that are added to the respective Maven artifact when it is created.

So when embedding libraries in a bundle you should make sure that you also configure respective Maven dependencies. Note that you do not need to include any transitive dependencies there.

Maven dependencies are specified using the Manifest header Unpuzzle-AddDependencies by Artifact group, name and version, separated by a semicolon. Multiple dependencies can separated by a comma. For Example:

Unpuzzle-AddDependencies: group1;name1;1.0,group2;name2;2.0
Clone this wiki locally