|Re: [tycho-dev] Get Metadata of a given repo from Tycho|
Yes, all the p2 things are only usable in OSGi bundles.
In order to get access to such a functionality, you’d define an interface in a “shared bundle”, provide an implementation in a normal bundle and register that implementation as OSGi service, and then obtain the instance from the mojo via EquinoxServiceFactory.getService(Class<T>). The “shared bundles” bridge the two classloader worlds: They are loaded by the Maven class loader and exposed to the real OSGi bundles as extra system packages (see TychoOsgiRuntimeLocator).
AFAIK, Igor has implemented explicit support for extending Tycho’s OSGi runtime, e.g. for your own OSGi services. To do this, you’d need to create your own shared bundle and implementation bundle. The implementation bundle can be added to the OSGi runtime via a new TychoOsgiRuntimeArtifacts component. (To add components, you’d need to add the jar defining the component as extra dependency of the Tycho build extension AFAIK.) Your shared bundle also needs to be added as dependency to Tycho’s build extension. AFAIK, there is no extension mechanism for additional system packages, but this shouldn’t be hard to add.
I’ve never seen this in practice, so if you get this to work, I’d be interested to see it.
Back to the top