天天看点

Intellij IDEA配置tomcat热部署

idea2017+tomcat8为本文的实验环境

1.打开tomcat的edit configuration,一定要选择war exploded 

在idea tomcat 中server的配置里,有个on frame deactivation,选择update classes and resources。另外有个配置on update action,就是手动操作的时候采取什么动作,可以重启服务器,也可以像上面一样更新类和资源文件,我选的是Redeploy。 可是当前项目没有update classes and resources这个选项,有个Hot Swap classes。

这是由于服务器添加的Artifact类型问题,一般一个module对应两种类型的Artifact,一种是war,一种是war explored。

war就是已war包形式发布,当前项目是这种形式,在这种形式下on frame deactivation配置没有update classes and resources选项。war explored是发布文件目录,选择这种形式,on frame deactivation中就出现update classes and resources选项了

2.选择update classes and resources 

on ‘update‘ action:当用户主动执行更新的时候更新    快捷键:Ctrl + F9

on frame deactication:在编辑窗口失去焦点的时候更新

你可以根据自己的需求进行设置,我这里两个都有设置。

3.配置基本就是这样,后面选择debug启动

博客中所涉及到的图片都有版权,请谨慎使用

继续阅读