扩展 tomcat 上的可重新加载目录集

Extend the set of reloadable directories on tomcat

我想扩展 tomcat 7.0.59 上的可重新加载目录集。 当 Context 中的 reloadable 属性设置为 true 时,tomcat 监视 类 in:/WEB-INF/classes//WEB-INF/lib

Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. That's why the default setting for this attribute is false. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.

整个系统分为模块,每个模块可以有自己的网络上下文(/WEB-INF/classes/) and/or扩展全局上下文(/classes/)。假设我想要 /classes/ 目录可重新加载。我怎样才能做到这一点?

我尝试使用 WatchedResource 标签,但没有效果:

<Context reloadable="true" path="/test" docBase="/MY_MODULE/web/webroot">
     <Manager pathname="" />
     <WatchedResource>/MY_MODULE/classes</WatchedResource>
</Context>

您可以尝试使用 HotSwapAgent 启动 tomcat:Plugin_tomcat. (GITHUB HotswapProjects)

您可以在每个模块上有一个不同的 hotswap-agent.properties 文件,以加载不同的类路径。