将大型* .war部署到tomcat的最佳方式 [英] Best way to deploy large *.war to tomcat

查看:117
本文介绍了将大型* .war部署到tomcat的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发过程中,我经常需要在远程测试服务器上部署大型战争文件(〜45 MB),通常我将scp文件复制到服务器。



WEB-INF / lib文件夹构成了war文件的最大部分,其中包括所有必需的库(spring,apache-cxf,hibernate,...)。



现在我正在寻找一种快速简单的方法来重新部署我的修改过的文件。



我如何确定哪些包真的需要webapp,因为spring和apache-cxf有很多libs,我确定我不需要所有的。

解决方案

当您部署 .war 时,Tomcat首先要将该文件解压缩到其 webapps 目录中,在与 .war 相同名称的子目录中。



在开发过程中,您显然可以访问您的 .class 文件, .jar 文件,配置文件和whate否则最终会进入你的 .war 。您可以轻松建立受更改影响的一小部分文件。把这个,然后使用一个脚本或一个蚂蚁任务或任何东西复制只是那么少的文件直接进入 webapps / yourapp 目录。



要查看更改生效,您需要重新启动应用程序。如果Tomcat处于开发模式,则强制重新加载(当然重新启动)的一个简单方法是更新 WEB-INF / web.xml 。所以您的部署过程触摸该文件或以其他方式更新它将给它一个新的时间戳, scp (也就是最新的文件),你应该快速轻松地重新加载。


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 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.

这篇关于将大型* .war部署到tomcat的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆