I guess my explanation was not really clear. A feature is required or not as the result of a user action: "features:install" will flag the feature as "required" and "features:uninstall" will unflag it. A feature becomes installed or uninstalled as the result of a FeaturesService's resolution. As a user, you don't have any direct way to change if a feature is installed or not. When the FeaturesService performs a resolution, it will look for all required features and their dependencies, and find which features need to be installed to solve those requirements. If a feature was not installed but the resolution computed it should be, it will be installed. If a feature was installed but the resolution indicates it's not needed anymore, it will be uninstalled. So in short, if you call "features:install", it will flag the feature as "required", and perform a resolution : the outcome will always be that this specific feature is installed. Your first use case was to uninstall a feature which was a dependency: you can't do that if the feature is needed by another feature, because the output of the FeaturesService's resolution will always be valid and applied.
For example, if you have a FeatureA that has a dependency on FeatureB. Here is the outcome of the commands when run in sequence feature:install FeatureA => FeatureA is required, FeatureA and FeatureB are installed, bundles from both features are installed feature:uninstall FeatureB => FeatureA is required, FeatureA and FeatureB are installed, no changes in bundles feature:install FeatureB => FeatureA and FeatureB are required, FeatureA and FeatureB are installed, no changes in bundles feature:uninstall FeatureB => FeatureA is required, FeatureA and FeatureB are installed, no changes in bundles feature:uninstall FeatureA => no features required, no features installed, bundles from both features are uninstalled Hope this clarify things a bit. 2018-01-23 18:43 GMT+01:00 paouelle <paoue...@gmail.com>: > Thanks Guillaume for the explanation. > > I will say that this is very confusing beyond the error message displayed > since a feature can still be "not required" and yet be reported as > installed > via the isInstall() or listInstalledFeatures(). > > In addition, calling uninstallFeature() does more than simply mark the > feature as "not required" as it actually removes it from the internal > 'state.installedFeatures' table at which point isInstall() will return > false > and listInstalledFeature() will no longer report it (same for the cmd > shell). > > There is definitely a difference in the implementation between > installed/not-installed vs required/not-required. > > Maybe specific methods to mark a feature required or not beyond the > confusing use of addRequirements(), removeRequirements() and > installFeature(), uninstallFeature() is in order. > > > > -- > Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html > -- ------------------------ Guillaume Nodet