IDEA配置JRebel實現熱部署
1.下載JRebel and XRebel for Intellij插件
2. 激活
請查看這個文章http://www.cicoding.cn/other/jrebel-activation/
激活后
開始配置自動編譯
3.勾選Build project automatically
ctrl + shift + alt + / ,選擇Registry,勾上 Compiler autoMake allow when app running
4.Edit Configurations
on update action和 on frame deactivation改成 update classes and resources
5.打開JRebel tool
6.勾選你要熱部署的應用
查看JRebel日志
使用JRebel啟動springboot項目
查看控制台日志
常見錯誤
jrebel.jar不兼容
JRebel-JVMTI [ERROR] You're using an incompatible 'jrebel.jar' with the JRebel Agent.
JRebel-JVMTI [FATAL] Please make sure that'C:\Users\XXX\AppData\Roaming\JetBrains\IntelliJIdea2020.2\plugins\jr-ide-idea\lib\jrebel6\jrebel.jar' is a copy of lib JRebel ZIP release \Jrebel.jar.
這可能是因為你的IDEA可能不是最新版本,但jrebel的jar包為最新版導致的,
因此請轉到官方網站下載你指定IDEA版本的JRebel壓縮包。然后解壓縮壓縮包以找到jrebel.jar,並將jrebel使用的jar包的路徑更改為解壓縮后的jrebel.jar的文件路徑。
再次使用JRebel啟動SpringBoot項目並成功啟動。如果修改代碼,將鼠標點向IDEA窗口以外的區域會自動build(或者手動按ctrl+shfit+F9)
MrBird nb