JRebel在maven中多模块的配置

文章目录
  1. 1. - pom.xml配置
  2. 2. - 生成rebel.xml
  3. 3. - 配置自动编译
  4. 4. - 运行命令
  5. 5. - 修改文件
  6. 6. - 参考链接

JRebel在maven中多模块的配置。;

- pom.xml配置

1.查看内核版本(Docker需要64位版本,同时内核版本在3.10以上,如果版本低于3.10,需要升级内核):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!--JRebel的配置-->
<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>jrebel-maven-plugin</artifactId>
<version>1.1.7</version>
<configuration>
<addResourcesDirToRebelXml>true</addResourcesDirToRebelXml>
<alwaysGenerate>true</alwaysGenerate>
<showGenerated>true</showGenerated>
<packaging>jar</packaging>
</configuration>
<executions>
<execution>
<id>generate-rebel-xml</id>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>

- 生成rebel.xml

然后在 maven-helper 的插件中 jrebel generator 生成 rebel.xml 文件。

- 配置自动编译

1.Go to File -> Settings -> Build, Execution, Deployment -> Compiler

勾选 build project automatically,如果拥有更大的内存的话,你还可以继续勾选 Compile independent modules in parallel 以加快编译。

配图:

2.Registry action window

1
2
3
4
5
6
7
8
9
10
11
Open the Action window :

Linux : CTRL+SHIFT+A

Mac OSX : SHIFT+COMMAND+A

Windows : CTRL+ALT+SHIFT+/

选择Enter Registry...

勾选compiler.automake.allow.when.app.running

配图:

- 运行命令

使用 run JRebel 来运行程序即可

- 修改文件

如果我修改了 VoUtilResource 这个类,那么 console 中会出现以下提示:

如果配置正确会出现2017-07-03 20:33:34 JRebel: Reloading class ‘com.xx.xx.rest.resource.VoUtilResource’.

配图

- 参考链接

官方文档上的JRebel的使用

视频教你在maven的多模块中配置JRebel

JHipster教你配置IDEA的热部署

免费申请JRebel的license

分享到