Reduce war size for frequent redeployments(uploads) to a remote server

自闭症网瘾萝莉.ら 提交于 2019-12-11 01:18:15

问题


While development I need to frequently update my web app source code & deploy the updated war to a remote Tomcat server. Uploading a big war(25MB) takes too long(around 30 min) on my connection which is very unproductive. Is there any way I could reduce the war size ? There are a lot of external dependencies in my project. Could I deploy just the changes(may be dependencies remain intact) ?


回答1:


What you are asking (Could I deploy just the changes?) cannot be done. There are other things you can do though to reduce the file size of your war file:

  1. You can place libraries in tomcat's common directory (tomcat-dir/common/lib) and remove them from your dependencies in your war file (Does Tomcat load the same library file into memory twice if they are in two web apps?).
  2. Place static file on a cdn or another web application on your tomcat (that would require code modification though)



回答2:


It depends how much control you have over the upload process. If you have remote access to the filesystem, the following should work:

  • Upload the WAR
  • Let Tomcat expand it
  • Stop Tomcat
  • Delete the WAR
  • Start Tomcat
  • Tomcat should run your app from the expanded directory
  • Upload changed files only and replace the old ones in the expanded directory
  • For static files, no further action is necessary
  • If up update classes or JARs, you'll need to restart Tomcat



回答3:


You can use git hooks (http://www.git-scm.com/book/en/v2/Customizing-Git-Git-Hooks). Altough, this requires a git repository on your webserver. Deployments may triggered by push events.




回答4:


Actually, if exploded war deployment is an option for you then you could use kwatee. It's a free and unrestricted tool (I'm the author) with a simple web interface (or CLI automation) that can do incremental exploded war updates and many other things.



来源:https://stackoverflow.com/questions/18525641/reduce-war-size-for-frequent-redeploymentsuploads-to-a-remote-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!