JRebel

作者: 路人面包匠 | 来源:发表于2017-06-23 17:11 被阅读0次

对于javaEE开发工作来说,开发过程中重复启动程序会导致开发效率低下,Jrebel可以实现热部署,开发者无需在修改代码后重启服务器来更新Java类文件,从而提高开发效率。
1.安装
安装可以通过help>eclipse Marketplace wizard中查找Jrebel插件。

安装Jrebel

安装完毕后进入Jrebel配置页面:

JRebel Configuration
2.注册
目前,Jrebel是付费软件,但是对于个人开发者,Jrebel推出了MyJrebel免费版本,详情见 https://my.jrebel.com
这里需要外网环境以及facebook或者Twitter账号。简单的信息输入后,会给你提供Activation Code。 Jrebel Activation
到此为止,恭喜你,激活成功。
3.配置
项目>properties>JRebel,创建或修改你的rebel.xml文件 JRebel 配置

默认自动会创建你自己的rebel.xml文件。这里经常有同学安装了JRebel但是运行出错,这是因为我们在日常工作中,会使用svn或git来做版本控制,如果团队中有人将rebel.xml配置文件上传了,碰巧你的工程目录和他的不相同,这时就需要修改rebel.xml文件来防止JRebel报错。
这里附上我的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会额外的占用你的内存,为了减少电脑的压力,可以将服务器的发布频率改为每次build后。

tips

第一次启动时使用JRebel的项目会略微长一些(因为他会启动JRebel),这时可能导致启动超过预定时间,需要将启动的Timeout 提高到60s。

相关文章

网友评论

      本文标题:JRebel

      本文链接:https://www.haomeiwen.com/subject/kcmccxtx.html