Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Oomph » Do not install optional p2 dependencies of requirements
Do not install optional p2 dependencies of requirements [message #1824366] Tue, 14 April 2020 12:54 Go to next message
Peter N is currently offline Peter NFriend
Messages: 6
Registered: February 2014
Junior Member
Hello!

We use Oomph in our company to install Eclipse-based products
In our products we want to use EGit plug-ins, so our product Oomph setup has EGit feature as requirement in Setup P2Task
But don't want JDT or JDT UI to be installed

EGit UI has optional dependency to "org.eclipse.jdt.ui"

How can i mark our EGit requirement to force p2 to skip EGit optional depencencies?

Tried set "greedy" to "false" but that doesnt work. As i read later, "greedy" means to provide ability for requirement to be installed from other sources, and that is not that i want
Re: Do not install optional p2 dependencies of requirements [message #1824413 is a reply to message #1824366] Wed, 15 April 2020 04:22 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Let me first explain what "optional" and "greedy" means.

An installable unit X declares an optional requirement on a capability Y if X provides extra functionality that becomes active if (and only if) some other installed unit Z provides the capability Y. The important point is that X can still be installed even if no other installed unit provides capability Y.

By default an optional requirement is non-greedy, which means that an installation of X does not automatically "pull in" any Z just because it provides a Y. If (at the same time or later) another installable unit Z1 is installed that provides Y the extra functionality of X becomes automatically active. If an optional requirement of X is declared to be greedy the installation of X will try to pull in a Z that provides Y, i.e., it will try to not leave the installation of Z to other IUs.

In fact org.eclipse.egit.ui declares the following

    <required namespace='osgi.bundle' name='org.eclipse.jdt.core' range='[3.12.0,4.0.0)' optional='true' greedy='false'/>
    <required namespace='osgi.bundle' name='org.eclipse.jdt.ui' range='[3.12.0,4.0.0)' optional='true' greedy='false'/>


Both requirements are non-greedy. That means, if org.eclipse.jdt.(core|ui) get installed, then not because of the requirement of org.eclipse.egit.ui but because of the non-optional or optional-greedy requirement of a third IU.

You have to find out what this third IU is and through what requirements it is pulled in from your root requirements. There's nothing in Oomph (or p2 for that matter) that let's you modify the requirement declarations of arbitrary IUs. If all "offending" requirements are optional-greedy, i.e., not non-optional, you may have a chance to specify a "negative" root requirement on org.eclipse.jdt. Newest Oomph versions allow to declare the cardinality of a requirement in terms of min/max. If you set max to zero the requirement becomes negative. To see the min/max attributes in the Properties view you must enable the "Show Advanced Properties" button.


Re: Do not install optional p2 dependencies of requirements [message #1824465 is a reply to message #1824413] Wed, 15 April 2020 18:03 Go to previous messageGo to next message
Peter N is currently offline Peter NFriend
Messages: 6
Registered: February 2014
Junior Member
You're right! Thank you

There was another feature (that we made by ourself, that is just a group of third-party plug-ings) that has optional dependency that transitively depends on jdt.core / jdt.ui:

1. My dependency of my third-party feature is "org.eclipse.xtext.builder"
2. It has optional (but not greedy!) dependency to org.eclipse.xtext.common.types.ui
3. org.eclipse.xtext.common.types.ui has non-optional dependency to jdt.core / jdt.ui

As result i see org.eclipse.xtext.common.types.ui installed in p2 profile and then jdt.ui

How do you think is it expected behaviour?

May i somehow mark org.eclipse.xtext.common.types.ui dependency of org.eclipse.xtext.builder as non-greedy ? May be somehow in "feature.xml"?
Re: Do not install optional p2 dependencies of requirements [message #1824480 is a reply to message #1824465] Thu, 16 April 2020 03:22 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Peter N wrote on Wed, 15 April 2020 20:03
How do you think is it expected behaviour?


Sorry, I don't get what you're asking.

Peter N wrote on Wed, 15 April 2020 20:03
May i somehow mark org.eclipse.xtext.common.types.ui dependency of org.eclipse.xtext.builder as non-greedy ? May be somehow in "feature.xml"?


As I already said, I know of no way for you to do this. Only the provider of org.eclipse.xtext.builder can do it.


Previous Topic:Installation failed with an error
Next Topic:Eclipse Update asking for workspace.location on startup
Goto Forum:
  


Current Time: Fri Apr 26 00:26:14 GMT 2024

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

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

Back to the top