Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » p2.inf to define optional dependency from feature to plugin?
p2.inf to define optional dependency from feature to plugin? [message #1733698] Tue, 31 May 2016 06:41 Go to next message
Mickael Istria - away until August 14th is currently offline Mickael Istria - away until August 14thFriend
Messages: 832
Registered: July 2009
Location: Grenoble, France
Senior Member

Hi,

I've got a feature that includes a bundle which only works with Neon (a
Require-Bundle version is set to explicit this dependency). However, I'd
like this feature to install anyway on Mars, minus that plugin.
It seems to me that what I'm looking at is the meaning of making a
dependency "optional" and that p2 supports well this kind of stories in
other places (Require-Bundle, optional inclusion/import of other
feature, or even platform-specific dependencies on fragments...),
however, the feature.xml file doesn't seem to allow to express such an
optional dependency on a bundle.

Is there something that can be tweaked in some p2.inf to define an
optional dependency from a feature to a bundle?
Re: p2.inf to define optional dependency from feature to plugin? [message #1733822 is a reply to message #1733698] Wed, 01 June 2016 08:44 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
I'm not sure if I understand your requirement correctly. A feature is a collection of bundles. If you don't specify feature dependencies () the feature should install containing all bundles. I haven't found something that tells that an included bundle is optional and not installed because of whatever reason. But if you have specified the minimum required version to another bundle in the bundle itself, it should not be activated on startup, because the dependencies are not resolved.

So what is the concrete question? Do you want to avoid that the bundle in charge is not even downloaded? Then I guess the answer is no, that is not possible? Is the question that the bundle should not be started? Then this should be already the case because of general OSGi mechanisms.
Re: p2.inf to define optional dependency from feature to plugin? [message #1733843 is a reply to message #1733698] Wed, 01 June 2016 12:10 Go to previous messageGo to next message
Pascal Rapicault is currently offline Pascal RapicaultFriend
Messages: 333
Registered: July 2009
Location: Ottawa
Senior Member
You need to add a p2.inf along side the feature.xml, and have it redefine the dependency that is normally defined in the feature.xml.
so if you had a dependency to org.eclipse.foo 1.2.1 then you would write something like:

requires.0.namespace=org.eclipse.equinox.p2.iu
requires.0.name=org.eclipse.foo
requires.0.version=1.2.1
requires.0.optional=true
Re: p2.inf to define optional dependency from feature to plugin? [message #1733872 is a reply to message #1733843] Wed, 01 June 2016 16:27 Go to previous message
Mickael Istria - away until August 14th is currently offline Mickael Istria - away until August 14thFriend
Messages: 832
Registered: July 2009
Location: Grenoble, France
Senior Member

Thanks Pascal, it works like a charm.
Previous Topic:Slow classloading after second start of equinox
Next Topic:Current Neon version seems to prevent JDKs JAX-WS implementation from working
Goto Forum:
  


Current Time: Sun Sep 23 15:45:50 GMT 2018

Powered by FUDForum. Page generated in 0.01380 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top