zoukankan      html  css  js  c++  java
  • Eclipse下安装/配置Jrebel6.X

    Eclipse3.6+下安装/配置Jrebel6.X

    1. 为什么要使用Jrebel

    在日常开发过程中, 一旦修改配置/在类中增加静态变量/增加方法/修改方法名等情况, tomcat不会自动加载, 需要重启tomcat才能使修改后的代码或配置生效.
    对于比较大的项目, 每次启动需要5min+时, 就比较浪费时间了.
    Jrebel插件可以让我们修改任何代码均不用重启, 可以大大减少重启项目所浪费的时间.

    Jrebel官网: http://manuals.zeroturnaround.com/

    2. 安装Jrebel插件

    安装Jrebel插件的方式有两种: 通过Eclipse Marketplace安装 或 通过从Jrebel官网下载插件后手动配置, 下面仅对通过Marketplace安装进行介绍.
    手工配置插件可以参考: http://www.blogjava.net/javajoyo/archive/2008/10/20/235495.html

    2.1. 通过Eclipse Marketplace安装
    • 打开 ** Help > Eclipse Marketplace**.

    • 搜索 Jrebel, 点击 Install.

    • 选择confirm

    • 选择"I accept the terms of the license agreement"

    • 点击"Finish", 等待安装即可. 安装完成后会提示重启Eclipse. 重启后即可看到Jrebel插件了.

    3. 激活Jrebel

    因为Jrebel是收费的, 所以安装好Jrebel后, 需要激活才能使用. 默认会有14天的试用期.
    建议在官网中进行激活 http://zeroturnaround.com/

    以下简单介绍下如何破解Jrebel.
    破解包下载地址: http://download.csdn.net/detail/leo_li_3046/9536324

    • 解压jrebel6.4.3-cracked.zip, 目录结构如下:

    • 替换jrebel下的jar

      windows下的路径为: C:/Users/Leo/.p2/pool/plugins/org.zeroturnaround.eclipse.embedder_6.4.4.RELEASE/jrebel

      linux下的路径为:~/.p2/pool/plugins/org.zeroturnaround.eclipse.embedder_6.4.4.RELEASE/jrebel

      用jrebel6.4.3-cracked/jrebel/jrebel.jar进行替换

    • 替换jr6/jrebel下的jar

      用jrebel6.4.3-cracked/jrebel6/jrebel.jar替换jr6/jrebel下的jar

    • 重启Eclipse, 通过"Window-->Preferences-->Jrebel-->Jrebel Configuration"查看是否已激活, 若显示如下图, 则表明已经激活

    4. 配置Jrebel

    安装激活后, 需要进行一些简单的配置, 如配置自动加载的时间/启动方式/jrebel agent等, 一般我们采用默认配置即可.
    通过"Window-->Preferences-->Jrebel-->Jrebel Configuration"进入Jrebel的配置页.

    • 自动加载时间设置, 一般设置10s左右, 根据你个人机器配置决定

    • 启动方式设置, 一般选择本地环境

    • jrebel agent配置
      有时根据环境影响, 直接选择Legacy Agent不能生效, 这时需要选择Jrebel 6 Agent 6.4.3版本

    5. 启动tomcat验证配置是否生效

    当显示下图结果时, 说明Jrebel已经配置成功, 这时你修改一个类或资源文件, 均会自动加载.

    注意: tomcat需配置自动加载资源, 最好以debug方式启动

    当一个项目使用maven多模块开发时通过上面的配置, 只能自动加载webapp所在的模块, 若想改动其他模块的代码也要自动加载, 需在项目的跟pom中加入下面的配置:

    <plugin>
        <groupId>org.zeroturnaround</groupId>
        <artifactId>jrebel-maven-plugin</artifactId>
        <version>1.1.5</version>
        <configuration>
            <addResourcesDirToRebelXml>true</addResourcesDirToRebelXml>
            <alwaysGenerate>true</alwaysGenerate>
            <showGenerated>true</showGenerated>
        </configuration>
        <executions>
            <execution>
                <id>generate-rebel-xml</id>
                <phase>process-resources</phase>
                <goals>
                    <goal>generate</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    

    配置好后, 你每次改动资源文件/JAVA文件均会自动加载. 如下图所示:

    若你的项目采用的是gradle, 可参照官网进行配置:
    http://manuals.zeroturnaround.com/jrebel/standalone/gradle.html

  • 相关阅读:
    CAS实战の简介
    高效程序员的45个习惯の排除万难奋勇前进
    高效程序员的45个习惯の对事不对人
    高效程序员的45个习惯の欲速则不达
    高效程序员的45个习惯の正确做事
    Java中Runnable和Thread的区别
    Intellij IDEA 14的注册机(Java版)
    session token防表单重提
    maven下@override标签失效
    Oracle sql 优化の索引监控
  • 原文地址:https://www.cnblogs.com/leo-li-3046/p/5690576.html
Copyright © 2011-2022 走看看