zoukankan      html  css  js  c++  java
  • IDEA下安装/配置Jrebel

    IDEA下安装/配置Jrebel6.X

    1. 为什么要使用Jrebel

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

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

    2. 安装Jrebel插件
    • 打开 ** File > Settings > Plugins**. 点击"Browse repositories".

    • 搜索 Jrebel, 点击 Install.

    • 坐等安装完成, 并重启IDEA, 重启后能看到Jrebel插件则表示已经安装完成. 如下面所示:

    • 若自动安装不行, 可通过手工安装的方式.
      Jrebel下载地址: http://download.csdn.net/detail/leo_li_3046/9537582
      下载解压后, 放到用户目录/.IntelliJIdea15/config/plugins下
      该版本已激活. 可直接使用.

    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/.IntelliJIdea15/config/plugins/jr-ide-idea

      linux下的路径为:~/.IntelliJIdea15/config/plugins/jr-ide-idea

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

    • 替换jrbel6/jrebel下的jar

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

    • 重启IDEA, 通过"File > Settings > Jrebel"查看是否已激活, 若显示如下图, 则表明已经激活

    4. 配置Jrebel

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

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

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

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

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

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

    [2016-06-01 12:23:21,536] Artifact jrebel-webapp:war exploded: Artifact is being deployed, please wait...
    
    #监听Class
    2016-06-01 12:23:22 JRebel: Directory '/home/leo/Pro/jrebel-server/jrebel-webapp/target/classes' will be monitored for changes.
    
    #监听xml配置文件
    2016-06-01 12:23:31 JRebel: Monitoring Spring bean definitions in '/home/leo/Pro/jrebel-server/jrebel-webapp/target/classes/spring/spring-context.xml'.
    
    #监听properties
    2016-06-01 12:23:35 JRebel: Monitoring properties in '/home/leo/Pro/jrebel-server/jrebel-webapp/target/classes/config.properties'.
    
    

    当一个项目使用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

  • 相关阅读:
    oracle执行.sql文件
    rematch的基本用法
    dva的基本用法
    redux-saga基本用法
    react-redux的基本用法
    redux的基本概念
    mobx基本概念
    centos 编译安装Apache 2.4
    javascript动态添加一组input
    php配置文件语法
  • 原文地址:https://www.cnblogs.com/leo-li-3046/p/5690587.html
Copyright © 2011-2022 走看看