This is most probably caused by a bug in p2:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=313553
which Tycho uses to resolve dependencies.
Question
I created an eclipse plugin that requires a certain capability in its manifest:
Require-Capability: osgi.service;filter:="(osgi.service=my.client.SessionService)"
My target platform contains another bundle that provides this capability. When I try to build this with Tycho I'm getting the following exception:
[ERROR] Internal error: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle my.client.rxp cannot be resolved
[ERROR] Resolution errors:
[ERROR] Bundle my.client.rxp - Missing Constraint: Require-Capability: osgi.service; filter="(osgi.service=my.client.SessionService)"
It seems that Tycho cannot handle OSGi Capabilities. Everything works fine as soon as I add the bundle that provides the capability as a required bundle to my eclipse plugin. But this makes no sense since the eclipse plugin shouldn't have any dependency to another implementation bundle. How can OSGi Capabilities be used in a Tycho build?
Solution
This is most probably caused by a bug in p2:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=313553
which Tycho uses to resolve dependencies.
OTHER TIPS
Thanks to jsievers, who provided the correct eclipse bug entry. Inside the bug entry there is a link to the Customizing p2 Metadata article. To cut a long story short, for p2 to handle capabilities correctly you have to provide capability advices by writing a p2 advice file (p2.inf).
I had to do the following to fix the capability resolution described in my question above. In the bundle that provides the capability there must be a META-INF/p2.inf file with the following contents:
provides.0.namespace = osgi.serviceloader
provides.0.name = my.client.SessionService
In the bundle that requires the capability there must be a META-INF/p2.inf file with the following contents:
requires.0.namespace = osgi.serviceloader
requires.0.name = my.client.SessionService
Much more capability advices options can be found in the article.