#### Feature groups

A feature represents a minimal configuration unit. When a configuration model reaches a certain level of complexity though, using and manipulating features to define the final configuration may become impractical.
Feature groups allow to group a set of features that represent a certain part of the configuration together and then later include them all into the final configuration as a group. For example

[source,xml]
----
 <feature-group-spec name="group1" xmlns="urn:jboss:galleon:feature-group:1.0">
   <feature spec="feature1">
     <param name="id" value="a1"/>
     <feature spec="feature2">
       <param name="id" value="b1"/>
     </feature>
   </feature>
   <feature spec="feature3">
     <param name="id" value="c1"/>
   </feature>
 </feature-group-spec>
----

[source,xml]
----
 <feature-pack xmlns="urn:jboss:galleon:feature-pack:1.0"
                groupId="org.jboss.pm.test" artifactId="fp1" version="1.0.0">
   <config>
     <feature-group name="group1"/>
   </config>
 </feature-pack>
----

First, we defined a feature group named *group1* which includes three features. The name of the group must be unique in the scope of the feature-pack. Feature groups are saved in the feature-pack's `feature_groups` directory in XML files named after the feature groups (*group1.xml* in this example).

Then in the default configuration of the feature-pack we simply included the *group1*.

Besides features, feature groups may also include other feature groups. Continuing the example above:

[source,xml]
----
 <feature-group-spec name="group2" xmlns="urn:jboss:galleon:feature-group:1.0">
   <feature-group name="group1"/>
   <feature spec="feature4">
     <param name="id" value="d1"/>
   </feature>
 </feature-group-spec>
----

[source,xml]
----
 <feature-pack xmlns="urn:jboss:galleon:feature-pack:1.0"
                groupId="org.jboss.pm.test" artifactId="fp1" version="1.0.0">
   <config>
     <feature-group name="group2"/>
   </config>
 </feature-pack>
----

The final configuration will now include all the four features. The order of the features in the resolved configuration will reflect the order in which the features were included into the configuration but also respecting the feature references and the dependencies, i.e.

. _feature1:id=a1_

. _feature2:id=b1_

. _feature3:id=c1_

. _feature4:id=d1_
