I am doing some research in the way i can deploy 开发者_Python百科an application efficiently using a war file. What i currently do is i deliver the war file everytime there is a release.
This means everytime there is a change no matter how small the change is i have to build and deliver all files that make up the application. I am thinking that maybe this is not the correct way to do this.
For example if there is a change to a css file i have to rebuild the war file which will include all file. This includes recompiling all *.java files as well.
In the above example, is it possible to build a war file with just the css file and deploy it to the tomcat server and have Tomcat just replace the css file and leave everything else as is?
You can do an "exploded" deployment which is just the war file unzipped. Then you can update the individual files. For that you place the "unpacked" directory where you would want to have the war file. If you use tomcat and look in the deploy directory, you'll see that that is what tomcat does anyway.
It is not guaranteed that the changes will be picked up though. CSS files and images and o forth should pose no problems, but JSP, template files etc tend to be compiled and cached and you have to do some config magic to have the app replace these artifacts. Typically this comes at a performance cost and may lead to the Dreaded PermGen Errors when classes are replaced but not freed from memory. If you do this, make sure you bounce your server regularly at a good moment, and keep an eye on the PermGen memory area with virtualvm or jconsole or similar tool.
精彩评论