Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Make a maven-plugin that consumes p2 API

On 02/13/2012 11:21 AM, Mickael Istria wrote:
For those who might be interested in the future, I found out a way to go:
* Add dependency to tycho-p2-publisher-plugin
* Make your mojo extends AbstractP2Mojo
* Enjoy its "loadCategories" method.
This is not enough: Category does not resolve to actual dependencies and keeps ".qualifier" suffix when parsed. Category is just given to the PublisherService which is responsible of doing all the magic.
I've looked deeper into Tycho code, and I took the VerifyIntegrityRepositoryMojo as example, since I'd like to use the same entry-point for my use-case (which is adding additional files to a newly created repo depending on its content). All the behavior that relies on p2 is externalized to the VerifyService. As far as I understand, this Service pattern is used to make the link between the Mojo context and the Equinox running p2.
I tried to find an existing Service in Tycho that would return me a model of the repository to query it, but this does not exist. Then I have 2 questions:
* Can I consume p2 API in my Mojo? I'd basically just like to get a IMetadataRepository. If yes, how?
* Do I HAVE TO create a service to get an IMetadataRepository?
* Is it possible/easy to create my own service? TychoP2RuntimeLocator has a static list of packages exported, and its containing jar has a static list of depdendencies...

Mickael Istria
Eclipse developer at JBoss, by RedHat
My blog - My Tweets

Back to the top