JRebel支持熱部署,和遠程熱部署,本文我們來搭建一下遠程熱部署。
1、官網下載最新的 JRebel 安裝包,下載鏈接:https://zeroturnaround.com/software/jrebel/download/prev-releases/
2、將下載好的包上傳至服務器,解壓:unzip jrebel-2018.2.1-nosetup.zip
3、進入目錄 jrebel,激活操作,執行命令:./bin/activate.sh http://139.199.89.239:1008/88414687-3b91-4286-89ba-2dc813b107ce 您的郵箱地址
4、設置遠程密碼,執行命令:java -jar jrebel.jar -set-remote-password 123456789
5、進入目錄 tomcat/bin,新建 catalina-jrebel.sh,內容如下:

#!/bin/bash export REBEL_HOME="[JRebel root folder]" export JAVA_OPTS="\"-agentpath:$REBEL_HOME/lib/libjrebel64.so\" -Drebel.remoting_plugin=true $JAVA_OPTS" `dirname $0`/catalina.sh $@
其中 REBEL_HOME 為服務端安裝路徑,如:/usr/local/tomcat/jrebel
6、設置執行權限后,啟動服務:./catalina-jrebel.sh run
1、IDEA 安裝 JRebel(參考:https://blog.csdn.net/liuzhigang828/article/details/72875190 )
2、打開 Settings -> JRebel -> Startup,右側選擇 “Run on a remote server or VM”,選擇對應的服務器,如“Tomcat 5.x,6.x,7.x,8.x and 9.x”
3、打開 Settings -> JRebel -> Remote Servers,配置如下:
4、打開 View -> Tool Windows -> JRebel,優選你要遠程熱部署的項目,如:
5、啟動項目后,修改代碼會自動同步遠程服務器。(詳細待測試)