在IntelliJ里配置JRebel實(shí)現(xiàn)Hybris熱部署
1. 打開IntelliJ的settings頁面

2. 在Plugins里安裝JRebel

3. 下載最新的反向代理工具
https://github.com/ilanyu/ReverseProxy/releases/latest
我是Windows 64,所以下載的是ReverseProxy_windows_amd64.exe
4. 運(yùn)行ReverseProxy_windows_amd64.exe

5. 重啟IntelliJ,打開JRebel的Activate頁面


6. 輸入Team URL
第一行輸入 : http://127.0.0.1:8888/guid
guid是一串隨機(jī)生產(chǎn)的字符串,可以在 https://www.guidgen.com/ 生成
第二行輸入 : 一個(gè)郵箱地址,郵箱格式正確就行,不需要是真的郵箱
點(diǎn)擊"I agree with the terms ...."選項(xiàng)框
然后點(diǎn)擊“Change license”按鈕(這個(gè)按鈕第一次激活時(shí)可能叫Activate JRebel)
7. 成功激活后,在Settings頁面點(diǎn)擊"Work offline"

8. JRebel為offline模式后關(guān)閉ReverseProxy_windows_amd64.exe窗口

10. 選擇"Run via IDE"

11. 在Jrebel Panel里選擇需要熱部署的項(xiàng)目, 所選項(xiàng)目里會(huì)自動(dòng)生產(chǎn)一個(gè)rebel.xml文件,里面配有classpath


12. 下載Jrebel zip文件
下載地址 :https://jrebel.com/software/jrebel/download/prev-releases/
把zip文件解壓到本地, 我的解壓到了 D:\Jrebel\jrebel

13. 更改$PLATFORM_HOME/config/local.properties文件,添加JVM的啟動(dòng)參數(shù)
tomcat.javaoptions=-agentpath:D:\\\\Jrebel\\\\jrebel\\\\lib\\\\jrebel64.dll
14. 先執(zhí)行ant all,然后用命令hybrisserver.bat啟動(dòng)hybris,如出現(xiàn)圖中信息則表示JRebel設(shè)置成功

15. 在IntelliJ里修改一個(gè)類然后recompile這個(gè)類,在Hybris啟動(dòng)的控制臺(tái)上就可以看到這個(gè)類被熱加載了


16. 在platform/project.properties文件里添加下面的命令可以以debug模式啟動(dòng)hybris時(shí)使用JRebel
tomcat.debugjavaoptions=-agentpath:D:\\\\Jrebel\\\\jrebel\\\\lib\\\\jrebel64.dll -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
Note:
Eclipse 和IntelliJ的配置差不多,如果在Eclipse里無法跟新class文件,可以打開一個(gè)cmd窗口(另起一個(gè)cmd窗口,不是Hybris啟動(dòng)的cmd窗口),在所改Java類的extension里執(zhí)行ant build

參考:
https://manuals.jrebel.com/jrebel/standalone/hybris.html

浙公網(wǎng)安備 33010602011771號(hào)