Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-dev] Get Metadata of a given repo from Tycho

Here is a working example [1], although it uses much much older version
of Tycho and I don't remember how much we changed in this area.

org.sonatype.m2e.discovery.publisher.p2.facade is the bridge between
Maven and OSGi classloaders. It defines facade interface visible both to
OSGi and Maven worlds.

org.sonatype.m2e.discovery.publisher.p2.impl is real OSGi bundle that
uses OSGi, P2 and Tycho P2 API.

org.sonatype.m2e.discovery.publisher.maven-plugin is the Maven plugin
that invokes OSGi/P2 services through the facade interface.

P2RuntimeMetadata, which implements TychoP2RuntimeMetadata interface, is
how Tycho knows what additional bundles should be added to embedded OSGi
framework instance at runtime. I don't remember how Tycho decides which
bundles should be loaded as bundles and which as "bridges".


[1] https://github.com/takari/m2eclipse-discovery


--
Regards,
Igor

On 2014-09-12, 6:52, Oberlies, Tobias wrote:
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.

Regards

Tobias

*From:*tycho-dev-bounces@xxxxxxxxxxx
[mailto:tycho-dev-bounces@xxxxxxxxxxx] *On Behalf Of *Mickael Istria
*Sent:* Freitag, 12. September 2014 11:56
*To:* tycho-dev@xxxxxxxxxxx
*Subject:* Re: [tycho-dev] Get Metadata of a given repo from Tycho

Thanks for this answer.
It seems to me that IArtifactRepository interface (and family) are only
visible from inside Equinox, and cannot be accessed directly from a
Mojo. Am I right? If so, does it means I'd need to wrap it in a service
(similarly to how BaselineService works) ? Is it possible to
define/register additional Equinox services from a Mojo ?

--
Mickael Istria
Eclipse developer at JBoss, by Red Hat <http://www.jboss.org/tools>
My blog <http://mickaelistria.wordpress.com> - My Tweets
<http://twitter.com/mickaelistria>



_______________________________________________
tycho-dev mailing list
tycho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-dev



Back to the top