`
jetway
  • 浏览: 484068 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

JRebel installs

阅读更多

Installation

JRebel installs as a JVM plugin (-javaagent) and works by monitoring the timestamp of class files. When it is updated (e.g. when a developer saves a class from the IDE) JRebel will reload the changes to class code and structure while preserving all existing class instances. The loading is lazy and will happen upon usage of the class (method call on an instance, static call on the class, field lookup etc).

Quick Start

  • On Java 5 add -noverify -javaagent:/path/to/jrebel.jar to the JVM command line.
  • On Java 1.4 you need to run java -jar jrebel.jar and then add -Xbootclasspath/p:/path/to/jrebel-bootstrap.jar;/path/to/jrebel.jar to the JVM command line.
  • If you use exploded development or a standalone application then set IDE to compile to WEB-INF/classes or system classpath and changes will be picked up immediately on save.
  • If you deploy as a WAR or an EAR then you need to create a rebel.xml configuration file as described further.

Some platforms and tools have their specific gotchas, so definitely take a look at the rest of the manual.

Step 0: Select your environment

窗体顶端

 

Java version:

Java 5 or later | Java 1.4

Operating system:

Windows | Unix-like (Linux, Mac OS X, etc)

Platform:

Standalone applications BEA Weblogic 9.x+ GlassFish V2 Google App Engine 1.x IBM WebSphere 6.1+ JBoss 4+ Jetty 5+ Maven/Jetty Oracle Application Server 9.x Oracle Application Server 10.x Resin 3.0 Resin 3.1+ SAP NetWeaver 7.1 SpringSource dm Server 1.0 Tomcat 5+ Other

窗体底端

Step 1: Configure the Platform

Tomcat

File: %TOMCAT_HOME%\bin\catalina.bat

Add the following line:

set JAVA_OPTS=-noverify -javaagent:jrebel.jar %JAVA_OPTS%

If you use the windows service or system tray startup use the following parameters instead:

-Xverify:none -javaagent:jrebel.jar

Step 2: Configure the Application

There are two ways to specify classes that will be monitored by JRebel for changes:

  1. All .class files in application classpath will be monitored by default (including system classpath, WEB-INF/classes, EJB module root, but exluding packaged JARs, WARs and EARs). If you use exploded or standalone development it is suggested to set the IDE compile output to application classpath and changes will be picked up on save.
  2. You can put a rebel.xml file in the application or module classpath to mount external folders to the application classpath. There should be one rebel.xml file per application or module. It can be placed in:
    • WEB-INF/classes
    • APP-INF/classes
    • EJB Module JAR root
    • Library JAR root

NB! Never place rebel.xml in system/server classpath as it will cause classloading errors!

The rest of this section applies only to rebel.xml configuration. If you’re using exploded or standalone development feel free to skip right ahead to the Configuring Tools section.

If you are using Maven to build your application, we’d suggest you to use the Maven JRebel plugin to generate rebel.xml for you. You can read about it in the Configuring Tools section.

Configuring JARs

JARs are usually not deployed on their own, but as a part of application (e.g. WEB-INF/lib in WARs or EJB modules in EARs). However often you still want to update their code on-the-fly. Let’s assume that we have a module my-business-module.jar deployed in WEB-INF/lib. You can propagate the changes from your workspace by adding the following rebel.xml to the root of the JAR file:

<?xml version="1.0" encoding="UTF-8"?>
<application

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xmlns="http://www.zeroturnaround.com"

  xsi:schemaLocation="http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
  <classpath>

    <dir name="c:\myWorkspace\myBusinessModule\target\classes"/>
    <dir name="c:\myWorkspace\myBusinessModule\src\main\resources"/>
  </classpath>

</application>

   

This will mount classes and resources in directories c:\myWorkspace\myBusinessModule\target\classes and c:\myWorkspace\myBusinessModule\src\main\resources before the classes and resources in the JAR file. Changes to those classes and resources will propagate to the application.

Configuring WARs

In the case of a web application you have web application resources, like JSPs, HTML files, graphic files and so on in addition to the classpath. To configure a web application deployed as a WAR file we create a rebel.xml file in the WEB-INF/classes directory:

<?xml version="1.0" encoding="UTF-8"?>
<application

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xmlns="http://www.zeroturnaround.com"

  xsi:schemaLocation="http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
  <classpath>

    <dir name="c:\myWorkspace\myWar\target\classes"/>
    <dir name="c:\myWorkspace\myWar\src\main\resources"/>
  </classpath>

  <web>

    <link target="/">
      <dir name="c:\myWorkspace\myWar\src\main\webapp"/>
    </link>

    <link target="/jsps/">
      <dir name="c:\myWorkspace\myWar\src\main\jsps"/>
    </link>

  </web>

</application>

This will mount classes and resources in directories c:\myWorkspace\myWar\target\classes and c:\myWorkspace\myWar\src\main\resources to the application classpath before the deployed classes and resources. This means that those classes and resources will override the ones in WEB-INF/classes and WEB-INF/lib/*.jar. Changes to those classes and resources will propagate to the application.

This will also map the web resources in the c:\myWorkspace\myWar\src\main\webapp directory to the root (”/”) of the web application context and the web resources in c:\myWorkspace\myWar\src\main\jsps directory under the /jsps/ URI of the web application context. You may map several directories to one context target if necessary.

Configuring EARs

To configure a EAR you need to create a separate rebel.xml file for each EAR module. Web modules should be configured same as individually deployed WARs, EJB modules should be configured same as JARs. If your container supports APP-INF/classes you may also add a rebel.xml to that folder and mount classes and resources that belong to the EAR as a whole.

Tips and Tricks

  • Putting absolute paths in the rebel.xml might be a bad idea as you’d like to share it with other team members. Luckily JRebel will expand expressions like “${myProject.root}” in rebel.xml to a system property that you can pass to the application container as -DmyProject.root=c:/myWorkspace/myProject. This allows to use a single configuration for everyone and then customize it when starting the server.
  • You are not limited to mounting directories to classpath. You can also mount JARs with <jar>.
  • If you need to mount a bunch of directories or JARs at once you can use <dirset> or <jarset> that accepts Ant-style patterns to specify the specific directories.
  • You can use Ant FileSet-style include and exclude directives in <dir> and <jar> entries.

Read about those options and more in the configuration manual.

Step 3: Configuring Tools

IntelliJ IDEA 

To enable debugger to work with JRebel you should install this plugin.

You should configure the debugger to ignore synthetic methods. To do that open up debugger properties (File -> Settings -> Debugger). On the lower left corner of the debugger settings page make the necessary changes. Be sure to tick Skip synthetic methods checkbox and add the filters for com.zeroturnaround.* and org.zeroturnaround.*. You should also untick the checkbox Synthetic fields in the Show block of File -> Settings -> IDE settings -> Debugger -> Data Views

To stop IDEA from rebuilding the WAR file on every save right click on the web application, go to File -> Project Structure, click on the Web component of your web project (it’s a blue icon.), and then click on Java EE Build Settings. Uncheck both Create web facet war file, and Web Facet Exploded Directory.

Eclipse 3.x

You should also configure the debugger to ignore synthetic methods. To configure Eclipse go to Window -> Preferences and from there to Java -> Debug -> Step Filtering (or just search for “Step filtering”). Enable step filters and Filter synthetic methods. Make sure that Step through filters is also on. Now enable all the default filters and add com.zeroturnaround.* and org.zeroturnaround.*.

See also:

Netbeans 6.5

To enable debugger to work with JRebel you should install this plugin.

Maven 2.x

If you’re using Maven to build your application you can use the JRebel Maven plugin to automatically create a rebel.xml configuration file during the build.

To quickly configure the Maven plugin for war, jar and ejb modules add the following to your pom.xml:

<pluginRepository>

  <id>zt-repo</id>

  <name>Zero turnaround repo</name>

  <url>dav:http://repos.zeroturnaround.com/maven2</url>

</pluginRepository>

  ...

<plugin>

  <groupId>org.zeroturnaround</groupId>

  <artifactId>jrebel-maven-plugin</artifactId>

  <executions>

    <execution>

      <id>generate-rebel-xml</id>

      <phase>process-resources</phase>

      <goals>

        <goal>generate</goal>

      </goals>

    </execution>

  </executions>

</plugin>

 

For the rest of configuration options please visit the Maven plugin configuration manual.

 

ECLISPE WTP 集成 JAVAREBEL

 

 

 

JavaRebel 是一个 JVM 插件 (-javaagent) ,能够即时重载 java class 更改,因此不需要重新部署一个应用或者重启容器,节约开发者时间。

 

<!-- [if !supportLists]-->1、  <!-- [endif]-->下载j avarebel.jar javarebel.lic 。注意

javarebel.jar 包不可改名,
javarebel.lic
放同目录

 

2 ECLIPSE 应用设好 TOMCAT 服务器后,进入【 Run > Run Configuration 】界面,在 VM 参数前加入 -noverify -javaagent:D:\tomcat5.5\bin\javarebel.jar ,如图:

<!-- [if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter" /> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0" /> <v:f eqn="sum @0 1 0" /> <v:f eqn="sum 0 0 @1" /> <v:f eqn="prod @2 1 2" /> <v:f eqn="prod @3 21600 pixelWidth" /> <v:f eqn="prod @3 21600 pixelHeight" /> <v:f eqn="sum @0 0 1" /> <v:f eqn="prod @6 1 2" /> <v:f eqn="prod @7 21600 pixelWidth" /> <v:f eqn="sum @8 21600 0" /> <v:f eqn="prod @7 21600 pixelHeight" /> <v:f eqn="sum @10 21600 0" /> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect" /> <o:lock v:ext="edit" aspectratio="t" /> </v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" style="width:414.75pt; height:259.5pt" mce_style="width:414.75pt; height:259.5pt"> <v:imagedata src="file:///C:\DOCUME~1\FNDSOF~1\LOCALS~1\Temp\msohtml1\01\clip_image001.png" mce_src="file:///C:\DOCUME~1\FNDSOF~1\LOCALS~1\Temp\msohtml1\01\clip_image001.png" o:title="" /> </v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->

 

 

3 、双击 Server Server 配置中选择自动发布,如图:

<!-- [if gte vml 1]><v:shape id="_x0000_i1026" type="#_x0000_t75" style="width:414.75pt;height:259.5pt" mce_style="width:414.75pt;height:259.5pt"> <v:imagedata src="file:///C:\DOCUME~1\FNDSOF~1\LOCALS~1\Temp\msohtml1\01\clip_image003.png" mce_src="file:///C:\DOCUME~1\FNDSOF~1\LOCALS~1\Temp\msohtml1\01\clip_image003.png" o:title="" /> </v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->

 

 

4 Server 模块中 Disable Auto Reload ,如图:

<!-- [if gte vml 1]><v:shape id="_x0000_i1027" type="#_x0000_t75" style="width:414.75pt;height:259.5pt" mce_style="width:414.75pt;height:259.5pt"> <v:imagedata src="file:///C:\DOCUME~1\FNDSOF~1\LOCALS~1\Temp\msohtml1\01\clip_image005.png" mce_src="file:///C:\DOCUME~1\FNDSOF~1\LOCALS~1\Temp\msohtml1\01\clip_image005.png" o:title="" /> </v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->

 

 

5 、这样就配置完成了。启动 Server ,在 Tomcat 启动日志前看见日志:

##########################################################

 

  ZeroTurnaround JavaRebel 2.0-M1 (200812031605)

  (c) Copyright Webmedia, Ltd, 2007, 2008. All rights reserved.

 

  This product is licensed to Jacky Liu

 

##########################################################

 

6 、在修改类后,不需要重新发布,再次调用用, Console 输出:

JavaRebel: Reloading class 'com.nx.study.Test'.

 

7 、至此恭喜你,成功了!

 

8 、这个配置主要在集成测试方面有好的效率,并不能代替单元测试。

分享到:
评论

相关推荐

    jrebel插件+jrebel替换破解

    安装jrebel插件后找到C盘下的.jrebel文件,直接解压替换就可以用了。

    jrebel 6.5.0 crack 破解 jrebel.jar

    2.下载jrebel破解文件,放到eclipse的jrebel插件目录覆盖: plugins\org.zeroturnaround.eclipse.embedder_6.5.0.RELEASE\jrebel 3.启动eclipse 查看window-&gt;preferences-&gt;jrebel 会提示没有license,无视他吧,...

    JRebel插件安装指南.zip_JReble运用指南_ZHW_jrebel_jrebel setup guide

    **JRebel插件安装指南** JRebel是一款强大的Java开发者工具,它允许开发者在运行时立即看到代码更改的效果,而无需重新部署应用。这款插件极大地提高了开发效率,节省了构建和部署应用的时间。本指南将详细介绍如何...

    JRebel 插件

    **JRebel 插件详解** JRebel 是一款强大的Java开发工具插件,它能够极大地提高开发者的生产力,尤其是在进行持续集成和快速迭代时。JRebel 的核心功能是实时应用代码更改,无需重启应用服务器,即可看到代码变动的...

    JRebel破解方法1

    JRebel破解方法1

    IDEA安装JRebel 插件

    IDEA安装热部署插件JRebel

    jrebel4.1版本

    《JRebel 4.1版本:提升Java开发效率的利器》 JRebel是一款备受开发者欢迎的实时应用服务器插件,它极大地提高了Java开发者的效率,尤其在JRebel 4.1版本中,这一优势更为显著。该版本专为IntelliJ IDEA集成开发...

    tomcat远程debug与jrebel热部署文件

    在`catalina-jrebel.bat`中,你需要引入JRebel的jar文件(这里为`jrebel.jar`),并在启动参数中加入JRebel的相关配置: ```bash set JPDA_OPTS=-javaagent:jrebel.jar ``` 此外,`jrebel.info`文件通常用于记录...

    IDEA JRebel热部署插件jar包

    **IDEA JRebel热部署插件jar包详解** 在Java开发过程中,IDE(Integrated Development Environment)扮演着至关重要的角色,而IntelliJ IDEA作为其中的一款顶级IDE,为开发者提供了丰富的功能和高效的开发体验。然而...

    jrebel idea 插件包

    JRebel是一款强大的Java开发工具,它允许开发者在不重启应用服务器的情况下实时看到代码更改的效果,极大地提高了开发效率。Idea是JetBrains公司推出的著名Java集成开发环境IntelliJ IDEA的简称,广受开发者喜爱。...

    Jrebel安装使用教程

    **JRebel安装使用教程** JRebel是一款强大的Java开发工具,它允许开发者在不重启应用服务器的情况下实时看到代码变更的效果,极大地提升了开发效率。本文将详细介绍JRebel的安装和使用过程。 ### 一、JRebel简介 ...

    Tomcat热加载Jrebel

    【标题】:Tomcat热加载Jrebel 在Java Web开发中,Tomcat是一个广泛使用的应用服务器,用于部署和运行Servlet和JSP应用程序。然而,每次修改代码后,都需要重新启动Tomcat来使更改生效,这无疑降低了开发效率。为了...

    jrebel破解版 最新的jrebel 7.1.2 破解版

    jrebel破解版 最新的jrebel 7.1.2 破解版 jrebel破解版 最新的jrebel 7.1.2 破解版jrebel破解版 最新的jrebel 7.1.2 破解版

    jrebel6.4.1 热部署神器

    **JRebel 6.4.1:热部署神器** 在软件开发过程中,尤其是Java后端开发,我们经常需要频繁地修改代码以测试不同的功能或优化性能。每次修改后,传统的方法是重新编译并部署应用,这不仅耗时,而且打断了开发的连续性...

    idea中jrebel插件

    idea中jrebel插件,也可在官网去找,方便开发,一个热部署,热更新的插件

    JRebel eclipse 热部署

    JRebel eclipse 热部署

    jrebel的Eclipse插件

    JRebel是一款强大的Java开发工具,它允许开发者在Eclipse集成开发环境中实时看到代码更改的效果,无需重新编译和重启应用服务器。这个Eclipse插件极大地提升了开发效率,减少了等待时间,让开发者能够更快地迭代和...

    jrebel6.4.3破解独立java程序可用版本

    -noverify -javaagent:D:\apps\jrebel6.4.3\jrebel.jar -Xbootclasspath/p:D:/apps/jrebel6.4.3/rebelboot.jar -Drebel.base=D:\apps\jrebel6.4.3\.jrebel -Drebel.disable_update=true D:\apps\jrebel6.4.3这个为...

    Jrebel 离线激活配置 - 2020.06.09 到期

    Jrebel 离线激活配置 使用压缩包的文件覆盖替换本地 Jrebel 文件 本地 jrebel 配置文件一般在:C:\Users\(用户名)\.jrebel

    JRebel插件离线安装

    JRebel是一款JavaEE开发工具。JRebel允许开发团队在有限的时间内完成更多的任务修正更多的问题,发布更高质量的软件产品。 IDEA上原生是不支持热部署的,一般更新了 Java 文件后要手动重启 Tomcat 服务器,才能生效...

Global site tag (gtag.js) - Google Analytics