jrebel插件实现热部署



 一、eclipse中 jrebel 插件的安装:

 

1. help-->install new software....

2.点击Add...   Name:jrebel,    location: http://www.zeroturnaround.com/update-site/

3.获取插件信息后选择安装JRebel,勾选看图附件 jrebel插件勾选图.png


4.之后next,直到finish. 重启eclipse.

 

二、配置jrebel:

 

1.重启完毕后,开始设置 JRebel参数,进入 Eclipse后选择 Window——> Performance。

2.在左侧选择 JRebel,然后点击 Browser…按钮选择你的 jRebel.jar存放路径。

3.在左侧选择 Java— Debug— Step Filtering,然后勾选 Use Step Filters和 Filter synthetic methods (requiresVM support)。点击 Add Filter 按钮添加 add com.zeroturnaround.* 和 org.zeroturnaround.*。看图附件  jrebel配置图.png


4.确认你勾选了 Eclipse的自动编译,菜单中 Project—— >Build Automatically。

5.在你所需的项目中右键点击选择JRebel-->Generate rebel.xml...  选择项目中的classes文件夹,这样它就可以监控该文件夹下的所有.class文件了。看图附件  选择classes文件夹.png


6.继续在你所需要的项目中右键点击选择JRebel-->Generate rebel.xml in src/main/resources(我建的是maven项目);这样它就会在src/main/resources文件夹下生成一个类似如下结构内容的rebel.xml文件。

<?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 http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">

	<classpath>

		<dir
			name="D:/Workspaces/eclipse for sems2/cn.ac.iscas.gz.sems.web/target/classes">
		</dir>
	</classpath>

</application>

 如果你有很多个联动的maven项目,则只需要在<classpath>内加<dir>元素就OK了。

 

三、配置服务器,使服务器具有jrebel热部署的支持(以tomcat服务器为例)。

 

1.在EclipseServer 选项卡中点击右键New—Server 新建一个服务器(如果没有该选项卡,可以从菜单的Window——Show View --other--servers中打开)

2.我选的是Tomcat v5.5 Server(根据自己具体使用的来选择)。

3.双击新建好的服务,进入Overview配置参数...

4.选择Open lauch configuration,在(x)=Arguments选项卡中增加 配置VM arguments参数:

-noverify 
-Drebel.struts2-plugin=true 
-Drebel.spring_plugin=true  
-Xms256m -Xmx256m -XX:MaxNewSize=256m -XX:MaxPermSize=256m

前面的 参数是打开 JRebel对 struts和spring的支持,后面的参数可以防止系统发生 OutOfMemery异常。

5. 配置其他参数 看图附件 其他配置信息.png

a、 Server Locations选择 User Tomcat installation

b、 Publishing中选择 Never publish automatically

c、 Timeouts中 Start设置成 1000或更大

d、 JRebel Integration中两个复选框都选中


6.设置项目路径,点击 Server选项卡最下面的 Modules,点击 Add External Web Module, Document base选择到 你编译的webapp, Path输入 /xxxxx  这里就是你的访问路径了。

比如我的

Document base:D:\Workspaces\eclipse for sems2\cn.ac.iscas.gz.sems.web\target\sems

Path:/sems

至此,jrebel的配置算完成了,配置可能有点繁琐,要细心,要根据自己项目的实际情况配置,结构相同,但内容不可完全照搬。

 

对于代码中的测试,就根据自己的项目去做测试吧。

 

别忘了,jrebel监控的是classes文件夹下的文件!

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值