I have a requirement where I need to share some web resources (jsp, html, js, images, css etc.) across different Spring based Struts 2 applications. And seems like OSGi can be used to achieve this?
- Can some one give some pointers on how to achieve this with
OSGi? - And secondly I want to know is
OSGimature enough to be used in production applications?
Thanks in advance!
EDIT:
I went through this post and seems like people are able to share a web bundle across web applications. The only difference is that they did it with Spring MVC. I want to know whether this can be achieved with Struts2 applications also?
EDIT 2: I am basically little unclear about the following:
- Will the ‘shareable-bundle’ (containing the web resources to be shared) be a .war packaged. If yes, then from where will the final web context be formed since this bundle is again to be shared with the main ‘web’ application? I am expecting the final web context to be formed out of the merging of the ‘shareable-bundle’ and the ‘main’ web application. Will it happen automatically? Any ideas?
While OSGI might be a solution, it might be a bit overkill (and, as Bozho pointed out, you’ll need an OSGI capable container). Maybe have a look at How to share resources across projects in Maven for other options:
EDIT: To answer a comment from the OP. Yes, the idea it to create an assembly of the shareable web resources and to use the maven-dependency-plugin to pull and unpack the assembly in the “resource-consumer” projects. All this is explained and detailed in the blog post mentioned above. Let me know if anything is unclear in it.