简体   繁体   English

如何在不影响Tomcat的情况下替换已编译jar中的文件

[英]How to replace file in compiled jar without affectig Tomcat redeploy

We are working on Liferay platform, which uses Tomcat servlet. 我们正在使用Tomcat servlet的Liferay平台上工作。 We have deployed modules, which consist another our compiled jars. 我们已经部署了模块,其中包含另一个已编译的jar。 Now, we wrote simple program, that monitor our resources and replace them in webapps folder if changes detected. 现在,我们编写了一个简单的程序,该程序可以监视我们的资源,并在检测到更改时将其替换到webapps文件夹中。 This works fine, but when we are trying to replace sources in compiled jars (js, html etc), then Tomcat detect changes and start redeploy. 这可以正常工作,但是当我们尝试替换已编译的jar(js,html等)中的源代码时,Tomcat将检测到更改并开始重新部署。

Is there any way to replace resources in compiled jars without affecting Tomcat redeploy automatically? 有什么方法可以在不影响Tomcat自动重新部署的情况下替换已编译jar中的资源吗? Our Tomcat redeploys take a lot of time, and we want to redeploy resources only on demand. 我们的Tomcat重新部署需要很多时间,我们只想按需重新部署资源。

You can disable autodeployment setting Host autoDeploy attribute to false. 您可以禁用自动部署,将Host autoDeploy属性设置为false。 Then you can use startup scripts, tomcat manager or REST api to redeploy. 然后,您可以使用启动脚本,tomcat管理器或REST api进行重新部署。

<Host autoDeploy="false"

See https://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html#Deploying_on_a_running_Tomcat_server 请参阅https://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html#Deploying_on_a_running_Tomcat_server

You can consider also to deploy on demand using the tomcat API and providing a war. 您还可以考虑使用tomcat API按需部署并提供战争。 There is an Ant task available. 有一个Ant任务可用。 See this example 这个例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM