热部署细节
2.1 前台页面的热部署
进入运行环境配置页面 Run->Edit Configurations,进入tomcat的运行配置html
主要在于 On frame deactivation选项配置选择为 Update classes and resourses(当且仅当在Deployment配置页,对应的目的war形式配置为exploded,即开发模式,才会出现该选项),该项配置意思即,在每次页面切换时,自动更新相关classes以及资源文件。
到这一步,已经能够实现前台页面资源文件的热部署,即每次修改完js或H页面等,只需刷新浏览器便可看到修改后的效果。
2.2 后台热部署
这里须要借助JRebel插件。
2.2.1 安装JRebel插件
进入插件安装页面,File->setting->Plugins,选择在线安装会比较方便,点击Browse Repositories,在搜索框里输入Jrebel,选择IDEA对应插件,点击Install安装。
2.2.2 Jrebel插件破解
能够去这里下载破解资源文件http://www.cr173.com/soft/191113.html,分别覆盖掉C:\Users\Administrator.IntelliJIdea15\config\plugins\jr-ide-idea\lib\jrebel和C:\Users\Administrator.IntelliJIdea15\config\plugins\jr-ide-idea\lib\jrebel6下的jrebel.jar文件,并将C:\Users\Administrator.jrebel下的所有文件删除,添加破解文件jrebel.lic.到此破解完成。
2.2.3 JRebel运行环境配置
进入File->setting->JRebel->Advanced,在JRebel agent to use 选项下,选择use jrebel.jar from the path specified
3 运行
在tomcat deploy配置选项下,选择exploded包(而不是war包)进行测试部署。Run/Debug选择右上角 run/debug with JRebel图标,运行或调试server.
至此,启动tomcat以后,不管修改任何文件,都无需额外操做,直接刷新浏览器页面便可看到更新后的操做。web