#### Feature dependencies

[[feature-deps]]While references are a kind of dependencies, they require parameters in the spec of the feature declaring the reference to identify the target. Unlike references, feature dependencies do not use parameters to specify the target. Instead the dependency is declared by specifying the ID of the target feature directly.

##### Feature spec dependencies

Feature dependencies can be declared in the feature spec and/or on the feature itself. Here is an example of a dependency declaration in the feature spec:
[source,xml]
----
 <feature-spec xmlns="urn:jboss:galleon:feature-spec:1.0" name="feature1">
   <deps>
     <dep feature-id="feature2:id=123"/>
   </deps>
   <params>
     <param name="name" feature-id="true"/>
   </params>
 </feature-spec>
----

Now all the features of spec `feature1` will depend on the feature with ID `feature2:id=123`.

##### Feature config dependencies

And here is how a feature dependency can be declared on a specific feature:
[source,xml]
----
 <feature spec="feature1">
   <deps>
     <dep feature-id="feature3:id=789"/>
   </deps>
   <param name="name" value="abc"/>
 </feature>
----

Now feature `feature1:name=abc` depends on feature `feature2:id=123` (inherited dependency from the spec) and feature `feature3:id=789`.

##### External feature dependencies

It is allowed to delcalre dependencies on features that come from other feature-packs. If the specs of those features come from feature-packs that appear to be dependencies of the feature-pack the feature dependencies are configured in then those feature specs will most probably be located by the mechanism automatically (by navigating the feature-pack dependency tree). The mechanism might need some help resolving the specs of the dependencies only if they belong to a feature-pack that doesn't appear to be a dependency of the feature-pack where the dependencies are defined or if there are multiple feature specs with the same name in the feature-pack dependency hierarchy and it's not obvious which one is targeted by the dependency.

NOTE: the feature spec resolution mechanism will pick the first feature spec with the matching name met while navigating the feature-pack dependency tree.

There is a way though to specify the origin of the feature spec used in the dependency. If `feature3` spec was from another feature-pack than `feature1` spec then to be precise we could have added the origin of `feature3` spec to the dependency declaration. Assuming that the feature-pack `feature1` spec belongs to declared a dependecy named `fp2` on the feature-pack `feature3` spec belongs to, the dependency declaration would look like this:
[source,xml]
----
 <feature spec="feature1">
   <deps>
     <dep feature-id="feature3:id=789" dependency="fp2"/>
   </deps>
   <param name="name" value="abc"/>
 </feature>
----

##### Implicit inclusion of feature dependencies

Like references, dependencies also support `include` attribute. If the dependency is declared with `include=true`, the target of the dependency will implicitly be included into the configuration unless it is already present. Here is an example of an implicitly included feature dependency:
[source,xml]
----
 <feature spec="feature1">
   <deps>
     <dep feature-id="feature3:id=789" include="true"/>
   </deps>
   <param name="name" value="abc"/>
 </feature>
----
