I have a server application that consists of multiple OSGi bundles, some mine, some third-party. One of the bundles provides a web frontend using Struts. The necessary Struts libraries live inside the web front-end bundle.
Now I want to add a second bundle that provides another web front-end, with different dependencies and a very different use case. I want to use Struts for that bundle, too, but I don’t want to put the same libraries into two bundles.
With OSGi, it should be no problem to separate the Struts libs in a bundle of their own and use that from both my bundles. However, I couldn’t find Struts packaged that way.
Some quick googling and a look at the Struts homepage didn’t yield anything. I could find a plugin for Struts to run an OSGi container inside Struts, but that’s not what I want.
Take a look at the current struts bundles on http://repo2.maven.org/maven2/org/apache/struts/struts2-core/2.1.6/.
If you download struts2-core-2.1.6.jar for example, extract it and take a look at META-INF/MANIFEST.MF you’ll see that it does contain OSGI headers (Import-Package, Export-Package, Bundle-*):
No idea how you go about using them within an OSGi app – but in theory you can atleast reference them and do “stuff”!! 🙂