I have a Spring MVC application which has a public front-end WAR, an admin front-end WAR and a shared services JAR. My two front-end projects rely on various Spring JARs, as does my shared services JAR. The list of Spring JARs that they require are similar but different. Also, the two WAR based apps rely on the shared services JAR.
How would you deploy this set of apps/JARs in terms of bundling JARs or setting classpaths? Would you include all of the appropriate Spring JARs and the service JAR in to both WAR files? Would you put any and all shared JARs on to the classpath? If so, would you put them on the classpath for Tomcat (the app server I’m using) via a command line parameter or would you just add the classpath to the system classpath? Would you approach differ for development and production scenarios?
For reference I’m using Maven which already packages everything in to the WAR files, though I’m not sure if that’s the best practise way to do it.
UPDATE: For reference, I found this page very useful reading: http://www.mulesoft.com/tomcat-classpath
Thanks,
James.
Keep your war files self contained rather than putting stuff on the system classpath. Then you won’t have to worry about class loading issues between your system and webapp classloaders and will save yourself a ton of frustration in the long run. Disk space is cheap, as is memory.