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 is currently offline Mickael IstriaFriend
Messages: 865
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: 2902
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 messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

Thanks Pascal, it works like a charm.
Re: p2.inf to define optional dependency from feature to plugin? [message #1796254 is a reply to message #1733843] Tue, 09 October 2018 08:37 Go to previous message
ilke Muhtar is currently offline ilke MuhtarFriend
Messages: 47
Registered: September 2015
Member
how can I make it work for multiple p2.inf files ?

please have a look at link :

https://stackoverflow.com/questions/52666844/how-to-trigger-multiple-changes-via-different-p2-inf-files-in-eclipse

Previous Topic:Conflicting touchpoint actions
Next Topic:[p2] use p2.inf to configure bundles within feature
Goto Forum:
  


Current Time: Fri Apr 26 12:09:54 GMT 2024

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

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

Back to the top