IDEA13 + Maven 3.1 + Tomcat6/7 + jrebel 4.5 热部署web应用
1、pom.xml中tomcat的配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
< plugin >
< groupId >org.apache.tomcat.maven</ groupId >
< artifactId >tomcat7-maven-plugin</ artifactId >
< version >2.2</ version >
< executions >
< execution >
< id >tomcat-run</ id >
< goals >
< goal >exec-war-only</ goal >
</ goals >
< phase >package</ phase >
< configuration >
< warRunDependencies >
< warRunDependency >
< dependency >
< groupId >cmsi</ groupId >
< artifactId >cmsi</ artifactId >
< version >1.0-SNAPSHOT</ version >
< type >war</ type >
</ dependency >
< contextPath >/</ contextPath >
</ warRunDependency >
</ warRunDependencies >
< enableNaming >true</ enableNaming >
</ configuration >
</ execution >
</ executions >
</ plugin >
|
2、在run/debug配置中添加本地Tomcat
注意:配置Tomcat实际上就是配置tomcat的vm参数,这个参数需要指定jrebel的jar在哪儿。
1
2
3
4
5
6
7
|
-noverify -javaagent:D:\jrebel- 4.5 -cr\jrebel.jar
-Xmx512M -Xms256M -XX:MaxPermSize=1024m -Drebel.spring_plugin= true
-Drebel.struts2_plugin= true
|
其他的配置含义是内存分配配置,以及对spring和struts2的支持配置!
3、如何使用
配置好了后,启动或调试tomcat,当类文件修改后,编译一下,这样classes就会被热部署到tomcat,避免重启。
如果上图中的4、5步骤没按照要求选择,则jrebel不起作用。
4、启动tomcat时候可以查看到jrebel是否生效,以及是否**了,
本文转自 leizhimin 51CTO博客,原文链接:http://blog.51cto.com/lavasoft/1365341,如需转载请自行联系原作者