Question

I have a huge eclipse-rcp project "A" with many RCP-plugins. All these are being manifest-first built by tycho. In a separate project "B" I have some OSGi bundles.

I need to add bundles from B as dependencies to some plugins in A. When I add B bundles in A-plugin's MANIFEST.MF ("Require-Bundle: B.bundle1"), tycho does not find B.bundle1 ("Unable to satisfy dependency from A.plugin 1.0.0 to bundle B.bundle1 0.0.0").

I know, that I can configure tycho to use pom dependencies (consider and add B.bundle1 as maven dependency). Tycho can build project A now, but it ignores all manifests in A plugins and generates new ones. It looks like project A is now considered being pom-first.

How can I add OSGi bundles to my plugins, keeping plugins's build manifest-first?

Was it helpful?

Solution

Tycho is never POM-first, i.e. it never generates a Bundle manifests. It does however read and write the Manifest source file during the build (in order to replace the .qualifier literal), so the manifest in the build result may be formatted differently to the original. It is however equivalent to the source.

Note that the by definition of the manifest file format, the last line of a manifest is ignored if it is not terminated by a newline character. So if this is the case in your sources, it may seem that Tycho removes a header from the manifest. This is kind of true, but only because the header was invalid and would be ignored by an OSGi runtime anyway.

AFAIK, the most recent Tycho version prints a warning if the last line of the source manifest isn't properly terminated.

OTHER TIPS

Tycho can find bundles in two places: a P2 or a Maven repository.

If your B bundles are in a maven repository, even if you add a Require-Bundle into manifest you will need to add a dependency into A's pom. This means that it is not completely manifest-first.

But it is, only when your dependencies (project B) are in some P2 repository. then you just need to set the manifest (Import-Package is better then Require-Bundle).

So, one alternative is you do create a job in your CI to build and install bundles from project B into a maven repository (mvn install). Or do create a job that generate a p2 repository and deploy it to some HTTP server.

then create a job to build A where you will need to proper set its tycho build to use the generated maven repository... ( http://wiki.eclipse.org/Tycho/Target_Platform#.22POM_dependencies_consider.22) or the p2...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top