views:

38

answers:

2

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.

A: 

I don't think there's a faster way to redeploy only the changes to a WAR file.

If you deploy in exploded fashion you can see what file timestamps have changed and act accordingly, but you'll have to write code to do it.

I don't know if OSGi can be a help here. That would allow you to partition your problem into modules that are more independent and swap-able.

Just curious:

  1. How long does it take now?
  2. Do you use continuous integration to build and deploy?
duffymo
By biggest problem is the upload time to the remote server, the deployment it self runs quick and clean. I can only test the hole webapp on the remote server, because of the hudge and complicate subsystem on which the webapp build up.
Alex
+3  A: 

When you deploy a .war, the first thing Tomcat does is to unpack that file into its webapps directory, in a subdirectory with the same name as your .war.

During development, you obviously have access to your .class files, the .jar files, 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 an ant task or whatever to copy just that small handful of files straight into the webapps/yourapp directory 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 process touch that file or otherwise update it in a way that will give it a new timestamp, scp that over too (preferrably as the last of the files you update) and you should have a quick and easy reload.

Carl Smotricz