I have a web application deployed as a WAR file in Tomcat 7. The application is build as a multi-module project:
- core - packaged as JAR, contains most of the backend code
- core-api - packaged as JAR, contains interfaces toward core
- webapp - packaged as WAR, contains frontend code and depends on core
- customer-extensions - optional module, packaged as JAR
Normally, we can put our JSP files in the webapp project, and reference them relative to the context:
The question is what we do about JSP files that are specific to the customer-extensions project, that should not always be included in the WAR. Unfortunately, I cannot refer to JSPs inside JAR files, it appears. Attempting
results in a file not found in the JspServlet, since it uses
Traditionally, we "solved" this having maven unpack the customer-extensions JAR, locate the JSPs, and put them in the WAR when building it. But an ideal situation is where you just drop a JAR in the exploded WAR in Tomcat and the extension is discovered - which works for everything but the JSPs.
Is there anyway to solve this? A standard way, a Tomcat-specific way, a hack, or a workaround? For example, I've been thinking of unpacking the JSPs on application startup...