Some tips for Tomcat7.
Move the constant lib as external libs:
- Step 1: Copy the lib to somewhere else, e.g.
${catalina.home}/anyfish-lib
- Step 2: Eclipse: Properties for app > Deployment Assembly > Remove ‘Maven Dependencies’
- Step 3: Add following config in
/conf/context.xml: 1<Loader className="org.apache.catalina.loader.VirtualWebappLoader" virtualClasspath="${catalina.home}/anyfish-lib/*.jar" />
So the final packaged .war file size is reduced dramatically!
To achive Step 2 in maven, edit the pom.xml file:
|
|
Note the <packagingExcludes>%regex[WEB-INF/lib/(?!mylib-1.0.0-SNAPSHOT).*.jar]</packagingExcludes>
config above (Don’t package the common spring, logging libaries etc into .war file; keep only mylib.jar).
Deploy new version w/o shutting down tomcat
To deploy a new version of webapp without shutting down tomcat, use parallel deployment in tomcat7, refer to tomcat parallel deploy.
Note the <warName>${project.artifactId}##${maven.build.timestamp}</warName>
config above.