- Make the library an OSGi bundle (using
maven-bundle-plugin) and deploy it to a Maven repository
- Aggregate the library into an Eclipse feature, and put it into a p2 repository. We use the
textgridlab-dependenciesproject for that.
- Depend on feature in an Eclipse-only feature or the product, and depend on the bundle or its packages in your bundle.
In principle, your library can be OSGified by adding specific metadata to its Manifest file. There is a Maven plugin, the maven-bundle-plugin, created in the Apache Felix project and using the
bnd bundling tool, that is able to auto-generate the metadata for you. There are two alternative ways to use this plugin:
Your OSGified bundle will have two versions, and this is bound for trouble since the versioning systems are fundamentally different:
The Maven version will be used when (plain) Maven is used to resolve the library, e.g., from a Maven repository. The OSGi version is used by, e.g., Eclipse and p2. Note that Felix, as opposed to Tycho, includes a literal SNAPSHOT in the OSGi version number instead of expanding it, making different SNAPSHOTs of the same version indistinguishable for p2. Thus, you should update your snapshots' explicit version numbers if you want to force your plugin to land in the TextGridLab.
Including your library in a feature and in a p2 update site
We maintain a project as part of the TextGridLab build that is used for the transformation from the Maven world to the Eclipse/p2 world – textgridlab-dependencies. This project is integrated in the TextGridLab integration build, and we're using a Jenkins build to deploy its result to a p2 update site from which the other TextGridLab components fetch their dependencies.
Like the other TextGridLab components, textgridlab-dependencies uses the Git Flow model, so please push your commits into the
Integrating a new dependency
- Add the maven coordinates of your dependency to the
dependenciessection of textgridlab-dependencies' root POM. Please use a property for the version number.
- Add a feature submodule. We'd suggest you copy an existing feature submodule and adjust its names, don't forget to add a
modulesentry to the root pom.xml. You can also add your dependency to a suitable existing feature.
- You SHOULD either use a -SNAPSHOT (pom.xml) / .qualifier (feature.xml) version or you must explicitly increase your feature's version number every time you upgrade the included libraries.
pluginentry for your library to your feature.xml:
Code Block language xml title feature.xml excerpt linenumbers true
<plugin id="info.textgrid.utils.linkrewriter.core" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
The ID ② is the
Bundle-Symbolic-Nameof the OSGi bundle, it is typically generated by the maven-bundle-plugin using a sensible heuristic. You should use
install-size④ as these will by calculated on build. We also recommend to insert
0.0.0as version ⑤ – this will be replaced by the actual version used on build (and specified by you in the root
- Commit and push your changes and watch the integration build.