對(duì)于javaEE開發(fā)工作來說,開發(fā)過程中重復(fù)啟動(dòng)程序會(huì)導(dǎo)致開發(fā)效率低下,Jrebel可以實(shí)現(xiàn)熱部署,開發(fā)者無需在修改代碼后重啟服務(wù)器來更新Java類文件,從而提高開發(fā)效率。
1.安裝
安裝可以通過help>eclipse Marketplace wizard中查找Jrebel插件。

安裝Jrebel
安裝完畢后進(jìn)入Jrebel配置頁面:

JRebel Configuration
2.注冊(cè)
目前,Jrebel是付費(fèi)軟件,但是對(duì)于個(gè)人開發(fā)者,Jrebel推出了MyJrebel免費(fèi)版本,詳情見 https://my.jrebel.com
這里需要外網(wǎng)環(huán)境以及facebook或者Twitter賬號(hào)。簡(jiǎn)單的信息輸入后,會(huì)給你提供Activation Code。

Jrebel Activation
到此為止,恭喜你,激活成功。
3.配置
項(xiàng)目>properties>JRebel,創(chuàng)建或修改你的rebel.xml文件

JRebel 配置
默認(rèn)自動(dòng)會(huì)創(chuàng)建你自己的rebel.xml文件。這里經(jīng)常有同學(xué)安裝了JRebel但是運(yùn)行出錯(cuò),這是因?yàn)槲覀冊(cè)谌粘9ぷ髦?,?huì)使用svn或git來做版本控制,如果團(tuán)隊(duì)中有人將rebel.xml配置文件上傳了,碰巧你的工程目錄和他的不相同,這時(shí)就需要修改rebel.xml文件來防止JRebel報(bào)錯(cuò)。
這里附上我的rebel.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
Refer to https://manuals.zeroturnaround.com/jrebel/standalone/config.html for more information.
-->
<application generated-by="eclipse" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_1.xsd">
<classpath>
<dir name="C:/work/workspaces/crpay/workspace/epp_pm/target/classes">
</dir>
<dir name="C:/work/workspaces/crpay/workspace/epp_pm/target/test-classes">
</dir>
</classpath>
<web>
<link target="/">
<dir name="C:/work/workspaces/crpay/workspace/epp_pm/target/m2e-wtp/web-resources">
<exclude name="/"/>
</dir>
</link>
<link target="/">
<dir name="C:/work/workspaces/crpay/workspace/epp_pm/src/main/webapp">
</dir>
</link>
</web>
</application>
4.Tips
使用JRebel會(huì)額外的占用你的內(nèi)存,為了減少電腦的壓力,可以將服務(wù)器的發(fā)布頻率改為每次build后。

tips
第一次啟動(dòng)時(shí)使用JRebel的項(xiàng)目會(huì)略微長(zhǎng)一些(因?yàn)樗麜?huì)啟動(dòng)JRebel),這時(shí)可能導(dǎo)致啟動(dòng)超過預(yù)定時(shí)間,需要將啟動(dòng)的Timeout 提高到60s。