JRebel Quick Start Eclipse zh_TW - lukechi1219/DynamicWeb GitHub Wiki
Eclipse
JRebel 快速入門 for Eclipse
https://zeroturnaround.com/software/jrebel/quickstart/eclipse/
60 秒 JRebel 簡介 https://vimeo.com/112443042
http://zeroturnaround.com/company/ http://zeroturnaround.com/rebellabs/developer-productivity-report-2012-java-tools-tech-devs-and-data/ http://zeroturnaround.com/rebellabs/developer-productivity-report-2016-java-tools-and-technologies-sneak-peek/ http://files.zeroturnaround.com/pdf/JRebelWhitePaper2014.pdf
JRebel 簡介
from http://chen7768.blogspot.tw/2011/04/jrebel.html 以每個工程師去寫 web 而言,平均至少要花約 30~60 次來重啟 tomcat ,每一次重啟 tomcat 後再加上登入到需要的頁面再做測試,每次約要 2-3 分鐘。 30 * 2 ~ 60 * 3 = 60 ~ 180 分鐘。
最近試了一下 JRebel ,發現他的神奇之處,Java compile 完後馬上就可以試改過後的結果,不用等 1 鐘後 tomcat 重啟然後還要重新 login 到需要的 page 再測試跑完的結果。用 JRebel 做為中介去開發,每天省下兩小時,不只可以提高生產率,也可以讓自己有多餘的時間去休息。
.
from http://shiue-webapp.blogspot.tw/2012/07/jrebel.html JRebel 是專門處理 Java project hot deploy的產品,相較於 Java 內建的Hot swap ,他的功能強大許多,換句話說,他針對了許多知名的套件,觀察其中的變化幫你自動 Hot Deploy。
.
from http://tc.chinawin.net/it/softwaredev/article-15193.html 在使用Eclipse/MyEclipse等開發Java程序的時候,當我們改動Java代碼的時候都需要重啓Tomcat等服務器,這樣會降低我們的開發效率.
JavaRebel 能夠管理Java文件編譯以後生成的.Class文件,實現單點替換.即修改了那一個文件,當我們使用到這個文件的時候,會把修改過的Java文件編譯後單點替換掉舊的文件. Tomcat等服務器由於在ClassLoader的時候具有級聯性,並不能實現這樣的單點替換,基本上都需要部分替換,效率明顯低於JavaRebel.
安裝
安裝 JRebel eclipse plugin
- 在 Eclipse 上方選單選擇 Help > Eclipse Marketplace…
- 用關鍵字搜尋 JRebel. 找到了嗎? 按下 Install.
如果安裝成功的話, Eclipse IDE 會重新啟動. 在重新啟動之後, JRebel 將會顯示提示訊息.
Activation 開通(激活) JRebel
取得 license
- 在 Eclipse 上方選單選擇 Help > JRebel Activation.
輸入表單, 可以有 7 天免費試用期.在 https://my.jrebel.com 用 fb 或 twitter 帳號登入就可以免費使用 JRebel.- 按下 Activate JRebel.
密技: 用 fb 或 twitter 帳號登入就可以免費使用 JRebel. https://my.jrebel.com
What is myJRebel? The home of your JRebel.
JRebel has changed the way developers code in Java. Never again will you need to redeploy your application to see the impact of
code updates. Make changes and JRebel applies them instantly to your running application. myJRebel brings these capabilities
to you for free for personal, non-commercial use only.
All you need to do is allow sharing your usage statistics on a social network.
Startup 設定
將 JRebel agent 加到你的 web server 或是獨立運作的 application
- 在 Eclipse 上方選單選擇 Help > JRebel Configuration > Startup.
- 勾選 Run via IDE.
- 勾選 check-box next to 你的 web server or application. Doing this will automatically run it with the required JVM arguments.
When successful, you will see the JRebel banner in the console right at server startup. This is what the JRebel banner should look like:
2016-04-25 13:48:25 JRebel: #####################################################
2016-04-25 13:48:25 JRebel:
2016-04-25 13:48:25 JRebel: JRebel Legacy Agent 6.4.3 (201604210950)
2016-04-25 13:48:25 JRebel: (c) Copyright ZeroTurnaround AS, Estonia, Tartu.
2016-04-25 13:48:25 JRebel:
2016-04-25 13:48:25 JRebel: Over the last 1 days JRebel prevented
2016-04-25 13:48:25 JRebel: at least 1 redeploys/restarts saving you
2016-04-25 13:48:25 JRebel: about 0 hours.
2016-04-25 13:48:25 JRebel:
2016-04-25 13:48:25 JRebel: #####################################################
Project configuration
Mapping your workspace to the deployed application
- Open Help > JRebel Configuration > Projects.
- Select the jrebel-ide-icon check-box next to your project. This will generate rebel.xml and keep it up to date.
- Redeploy your application!
When building your application, rebel.xml should be included within the application archive.
- In case of JAR files, rebel.xml should be included in the root folder.
- When working with WAR files, the rebel.xml should be located within the WEB-INF/classes folder.
- EAR files require a rebel.xml for each internal EAR module (that means JARs and WARs).
Reload your code
JRebel in action
- 確定 Eclipse 的 Project > Build Automatically is enabled!
- Restart your Java application.
- Change something in the application code.
- Refresh the application in the browser to see the changes!
JRebel relies upon your IDE to do the compiling. Enabling Build Automatically ensures that your .java files are compiled to .class files.
備註: 調整 Tomcat 設定
ref: https://asadbukhariblog.wordpress.com/2015/09/13/jrebel-eclipse/
Launch Tomcat configurations and make following changes in Overview tab
.
In Modules tab edit the modules by un-checking Auto Reload
.
You have completed JRebel configurations. Make sure that Tomcat configurations include the pointed out string in VM arguments