##### Merging package sets from dependency branches

Suppose feature-pack *fp1* depends on feature-packs *fp2* and *fp3*. Both *fp2* and *fp3* depend on their own custom package sets of feature-pack *fp4*. When *fp1* is installed, the effective package set of *fp4* will be a merge of custom package sets of *fp4* specified as dependencies of *fp2* and *fp3*.

For example:

[source,xml]
----
 <feature-pack xmlns="urn:jboss:galleon:feature-pack:1.0"
                groupId="org.jboss.fp.group1" artifactId="fp1" version="1.0.0" >
    <dependencies>
        <dependency groupId="org.jboss.fp.group2" artifactId="fp2" version="2.0.0"/>
        <dependency groupId="org.jboss.fp.group2" artifactId="fp3" version="2.0.0"/>
    </dependencies>
    <default-packages>
        <package name="p1"/>
    </default-packages>
 </feature-pack>
----

[source,xml]
----
 <feature-pack xmlns="urn:jboss:galleon:feature-pack:1.0"
                groupId="org.jboss.fp.group1" artifactId="fp2" version="1.0.0" >
    <dependencies>
        <dependency groupId="org.jboss.fp.group2" artifactId="fp4" version="2.0.0">
            <packages>
                <exclude name="p1"/>
                <exclude name="p3"/>
            </packages>
        </dependency>
    </dependencies>
    <default-packages>
        <package name="p1"/>
    </default-packages>
 </feature-pack>
----

[source,xml]
----
 <feature-pack xmlns="urn:jboss:galleon:feature-pack:1.0"
                groupId="org.jboss.fp.group1" artifactId="fp3" version="1.0.0" >
    <dependencies>
        <dependency groupId="org.jboss.fp.group2" artifactId="fp4" version="2.0.0">
            <packages inherit=”false”>
                <!-- assume fp4 also contains non-default package p4 -->
                <include name="p4"/>
            </packages>
        </dependency>
    </dependencies>
    <default-packages>
        <package name="p1"/>
    </default-packages>
 </feature-pack>
----

[source,xml]
----
 <feature-pack xmlns="urn:jboss:galleon:feature-pack:1.0"
                groupId="org.jboss.fp.group1" artifactId="fp4" version="1.0.0" >
    <default-packages>
        <package name="p1"/>
        <package name="p2"/>
        <package name="p3"/>
    </default-packages>
 </feature-pack>
----

If a user installs *fp1* without further customizations, the following packages will be installed:

* *fp1:p1* and its dependencies;

* *fp2:p1* and its dependencies;

* *fp3:p1* and its dependencies;

* *fp4:p2*, *fp4:p4* and their dependencies.
