If a feature needs functionality provided by another feature, it can be declared via the feature.xml
file of the feature itself. For example, installing the E4 feature may depend on some runtime components provided by JGit, so installing the JGit feature will mean that everything required is present. To add JGit as a dependency to the E4 feature:
feature.xml
file and go to the Dependencies tab.org.eclipse.jgit
from the list. It will fill in a version range using the exact version specified in the plug-in; invariably it is better to substitute that with a lower-bound version number since that will allow the feature to be installed with a dependency that is slightly lower. This will result in a feature.xml
file that looks similar to the following:<feature id="com.packtpub.e4.feature" label="Feature" version="1.0.0.qualifier" provider-name="PACKTPUB"> <requires> <import feature="org.eclipse.jgit" version="2.0.0"/> </requires> <plugin id="com.packtpub.e4.clock.ui" download-size="0" install-size="0" version="0.0.0" unpack="false"/> <feature/>
features/
directory will contain just the com.packtpub.e4.feature
, and the plugins/
directory will contain just the com.packtpub.e4.clock.ui
plug-in.By adding a dependency on another feature, when it is installed into a running Eclipse platform it requires that the other feature be present. If the Consult all update sites checkbox is selected, and if the feature is not installed and cannot be found from the current update site, other update sites will be consulted to acquire the missing feature.
Note that the JGit feature will not be present in the exported site. This is generally desirable since it is unnecessary to duplicate features that are available elsewhere. However, if this is desired then remove the dependency from the Dependency tab and add it to the Included features tab. This will result in the requires
dependency being changed to an includes
dependency in the feature.xml
file.