爲什麼要用jrebel插件
- 每次修改類和配置文件後 , 無需重啓服務 , 節約時間 .
配置步驟
在idea的插件倉庫中搜索下載並安裝 jrebel 6.5.2 (截止16年11月最新版) ;
下載破解補丁 , 解壓後替換 .jrebel 目錄 . 下載地址
在需要熱部署的模塊(一般爲父模塊)pom中 , 加入如下插件配置 .
<!--jrebel 熱部署插件-->
<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>打開idea中jrebel面板 , 勾選需要熱部署的modules , 然後點擊左上角 xml 配置文件 .
-只需要修改web模塊下的配置文件 , target改爲項目部署的名字 , 第二處改爲項目部署根目錄.
- 點擊工具欄中的 debug with jrebel 按鈕啓動項目即可 , 親測可用 .