So first, bundles are only updated / refreshed / restarted if necessary. If there's no change for a given bundle, it won't be touched at all.
The dependency="true" flag means that the artifact can be used by karaf to solve some constraints, but it won't be installed if not needed. This is mainly useful for imported packages or services, not for the core of your feature. For example you write a feature that needs apache commons-collections. If you don't add the dependency="true" flag on the bundle, it will always be installed, even if a newer version of commons-collections is required by another bundle, so you'll end up with 2 different versions of commons-collections in use. If you put the dependency="true" flag on the commons-collections bundles, then the resolver deploy only the latest bundle. The same idea holds if you put the flag on a feature: i.e. it will be used by the resolver, but if it is not needed, it may not be installed. 2017-12-08 10:27 GMT+01:00 Lukasz Lech <[email protected]>: > Hello, > > > > I’m quite confused about feature dependencies. The documentation about > provisioning doesn’t explain much how the dependency=”true” is expected to > work. I’ve tried adding or removing it, but I experience unexpected > behavior… > > > > I have a core feature and other features that depend on it. The system is > modular, and there are many production endpoints with diverse feature sets. > > > > I’ll try to present oversimplified example, which hopefully will give a > clue what could get wrong. > > > > I have <core>, that is used by any other actor. > > I have <service1-core> (API) that has 2 implementations, defined as > features <service1-impl1> and <service1-impl2>. > > I have <endpoint1> that uses only <core> > > I have <endpoint2> that uses <core> and <service1-core>. > > > > You can have only 1 implementation of service1. You can have one of 2 > endpoints, or both. > > > > The problem is, that when I install everything, I see in logs, many > bundles defined in <core> or <service1-core> are started many times. As > would the installation of another ‘consumer’ of that feature cause feature > to be reinstalled. What is worse, I’ve expected once infinite loop of > triggered restarts. > > > > What I need is a stable way to define the dependency from B to A, telling > that if B is going to be installed, and A is not present, A should be > installed, but if A is already installed, it should be not re-installed > neither re-started. > > > > So if I say, install service1-impl, the service1-core will be installed > and started. If I later say, install endpoint2, the service1-core will not > be touched, because it is already installed and running. > > > > Shoudn’t the dependency=”true” work that way? What can cause the common > feature to be reinstalled many times by installing dependent features? > > > > Best regards, > > Lukasz Lech > > > -- ------------------------ Guillaume Nodet
