Intellij IDEA 安装jrebel插件

    jrebel(http://zeroturnaround.com/)的做用就是当你的代码改变时,你不须要重启服务,节省了时间。代码的改变有不少种,好比增长class、在class中增长方法等等。下面介绍一下 java 开发利器 intellij idea 怎样安装 jrebel。java


1.安装 jrebel 插件

    在 intellij idea 中,打开 File - Settings(ctrl + alt + s),点击弹出的对话框中的 plugins。 



    点击对话框底部中间的按钮 Browse repositories...,在弹出的对话框中能够搜索你须要的插件。咱们搜索 jrebel。


    搜索后,会显示两个 jrebel 的插件。咱们安装 JRebel for Intellij,选中此插件,对话框右边有个绿色的 install plugin 按钮。点击安装便可。 安装完成以后,须要重启 intellij idea。

    安装好后,在 intellij idea 的右上角,有两个 jrebel 的图标。一个是正常启动模式,一个是 debug 模式。


2.破解 jrebel

    jrebel惟一很差的地方就是收费的 大笑。对于我等屌丝的话,只能默默破解了。我如今jrebel使用的版本是6.2.5。 点击这里,下载jrebel破解版。解压破解文件后,将
        jrebel.lic 复制到 C:\Users\你的用户名\.jrebel 下
        jrebel.jar 复制到 C:\Users\你的用户名\.IntelliJIdea14\config\plugins\jr-ide-idea\lib\jrebel 下
    
    打开 intellij idea (若是破解的时候,你的 intellij idea 是打开的,则须要重启),点击 File - Settings(ctrl + alt + s),点击 弹出对话框的 JRebel。右边的 License 显示 VALID,表示破解成功。恭喜!


3.使用 JRebel

    打开 intellij idea 左下角的 JRebel 选项卡,这里能够看到你的项目。若是你的项目想使用jrebel,勾选项目下的复选框便可。


    设置 tomcat 选项,点击 intellij idea 右上角。

    在 弹出的对话框 中,修改 红色框的内容,保存便可。


    点击   中的一个,启动服务吧。

    服务启动后,当你修改一个class 后,控制台 显示  JRebel: Reloading class ...,说明 jrebel 已经发挥做用了。


--------------------------------------------------------------------------------------------------------------------------------------------------------------------
2015-10-20 更新

若是修改了 class,jrebel 没有自动部署。那就设置一下 代码编译 后的输出目录。
1.打开 项目结构(ctrl + shfit + alt + s) 对话框,修改 class 的输出目录到 web 的 classes 下。


2.生成 jrebel 配置文件。在项目上右键 - jrebel - jrebel.xml。


3.重启服务便可。