During development I frequently have to deploy a large war-file (~45 MB) to a remote test server, normally I copy the file with scp to the server.
The WEB-INF/lib folder makes up the largest part of the war file, which includes all the required libraries (spring, apache-cxf, hibernate,…).
Now I’m searching for an fast and easy a way to redeploy only my altered files.
And how can I determine which packages are really needed by the webapp, because spring and apache-cxf comes with a lot of libs, I’m sure I don’t need all of them.
When you deploy a
.war, the first thing Tomcat does is to unpack that file into itswebappsdirectory, in a subdirectory with the same name as your.war.During development, you obviously have access to your
.classfiles, the.jarfiles, configuration files and whatever else eventually goes into your.war. You can easily establish a small subset of files affected by your changes. Figure that out, and then use a script or ananttask or whatever to copy just that small handful of files straight into thewebapps/yourappdirectory on the server.To see your changes take effect, you’ll need to re-start your application. If Tomcat is in development mode, one easy way to force a reload (and restart, of course) is to update
WEB-INF/web.xml. So have your deployment processtouchthat file or otherwise update it in a way that will give it a new timestamp,scpthat over too (preferrably as the last of the files you update) and you should have a quick and easy reload.