...
Embedding artifacts and libraries in the META-INF/lib directory of a contribution is simple but lacks the flexibility required by many applications. For example, several applications may need to share the same WSDL document or library. Fabric3 supports two three forms of sharing:
- XML resource sharing
- Java package sharing
- Java contribution sharing
In both cases, a resource (or set of resources) are exported by one contribution and *imported*by another. Imports and exports are specified in the contribution manifest file.
...
Code Block | ||||
---|---|---|---|---|
| ||||
<import.java package="org.foo.bar" version="1.0.0" required="false"/>
|
Contribution Imports and Exports
Fabric3 supports the ability to export and import all Java packages from a contribution using <export.contribution> and <import.contribution>. Matching is done using a symbolic name provided by the @uri attribute:
Code Block | ||||
---|---|---|---|---|
| ||||
<export.contribution package="MyContribution"/>
|
Code Block | ||||
---|---|---|---|---|
| ||||
<import.contribution package="MyContribution"/> |
It is recommended to use <export.java>/<import.java> instead of contribution importing to avoid unnecessary coupling between contributions. However, contribution importing is useful when an application is composed of multiple Maven modules where one module performs integration tests and requires access to non-public classes provided by the other.
OSGi Bundles
Fabric3 also supports packaging contributions as OSGi bundles. In this case, OSGi bundle manifests may be used to export and import packages from other contributions.
...