I'm investigating the use of OBR in Felix as a deployment option for a large application, but have encountered some initial hurdles.
Approach Taken
- I created a new jar with a manifest.mf listing every single application dependency(basically everything in a manual deployment), right down to third party libs, in the "Require-Bundle:" section. My intention was to first declare everything, and then pair it back and have third party bundles resolved via OBR
Indexed my local .m2 repository as an OBR using the maven-bundle-plugin
mvn org.apache.felix:maven-bundle-plugin:2.3.7:index
Started Apache Felix and added the OBR reository
obr:repos add file:///~/.m2/repository/repository.xml
Attempted to deploy the jar containing the entire application's bundle dependencies list
obr:deploy --required-only --start com.conorjgall.application.definition
Problems
There is a package requirement in some of the bundles on javax.inject due to the use of Spring's dependency injection. However, in the OBR there is more than one bundle advertising the capability for javax.inject. It is available in both a Spring bundle and a Google Guice bundle. Unfortunately the OBR resolver seems to pick the Guice implmentation which prevents my application from starting.
Workaround
If I remove the Guice library from the OBR index, the OBR resolver never finds it so the Spring implementation is used, and the application starts without issue.
Questions
- I have listed all dependencies in the high level application jar, including the one containing Spring's javax.inject implementation. Why is Felix's OBR resolver trying to resolve a package requirement when I have explicitly told it to deploy a bundle that already provides it? Is OBR resolution happening in a depth-first manner when I try and deploy in this manner (using a single bundle)?
- I'm curious what is the strategy normally used for creating/maintaining OBR repositories of third party libs to ensure there are no package capability conflicts. Should smaller OBR repository indexes be created and maintained, ones that only contain application dependencies and no package capability conflicts? Is there a maven plugin that could help?
- How does the wider community deploy >100 bundles at once via OBR? Perhaps there are better options than the parent bundle solution.