By default, a FAB adds each Maven dependency to its private class space at run
time (except for dependencies having Maven group ID org.apache.camel,
org.apache.activemq, or org.apache.cxf, which are
shared by default). This is a safe approach to deploying dependencies, because it
reduces the risk of version inconsistencies. But it is also an expensive approach,
in terms of resources, because it forces the JVM to maintain a dedicated copy of
each dependency in memory, just for this FAB.
You can make a FAB more economical by opting to share some of its dependencies with other applications in the container. There are two approaches you can use:
To share a dependency (and its transitive dependencies), declare a dependency with
the provided scope in your project's pom.xml file. For
example:
<dependency>
<groupId>org.acme.foo</groupId>
<artifactId>foo-core</artifactId>
<version>${foo-version}</version>
<scope>provided</scope>
</dependency>This is analogous to the approach you would use when building a WAR with Maven, in order to avoid including libraries like the servlet API or the JSP API.
You can also configure class sharing by setting the
FAB-Provided-Dependency: manifest header. For example, to share all
artifacts with the org.acme.foo Maven group ID:
FAB-Provided-Dependency: org.acme.foo:* org.apache.camel:* org.apache.cxf:* org.apache.activemq:* For full details of how to use this approach, see Sharing dependencies and How to set JAR manifest headers.








