IDEA 热部署(JRebel插件方式)

转载链接:https://www.jianshu.com/p/44ab73d6e5af

1. IDEA开启项目自动编译

File --> Settings --> Build,Execut, Deployment --> Compiler 勾选中左侧的Build Project automatically

2. IDEA开启项目运行时自动make

Ctrl + Shift + A 搜索命令:registry --> 勾选 compiler.automake.allow.when.app.running

3. 下载 JRebel:

链接:https://pan.baidu.com/s/1t7VvCxTwmv3UyXL-AQmXrA 密码:pm6i

4. 安装 JRebel

Ctrl + Alt +S ,打开 Plugins 选择 Install plugin from disk,选择下载好的 JRebel-6.4.3.zip 压缩包(不用解压),JRebel for Intellij 勾选中,点击ApplyOK,重启 IDEA 即可。

手动安装 JRebel

5. 使用 JRebel

JRebel 仅限 Debug 模式下使用,选择第二个 Debug 按钮即可

JRebel Debug模式下使用


6. 当一个项目使用maven多模块开发时通过上面的配置, 只能自动加载webapp所在的模块, 若想改动其他模块的代码也要自动加载, 需在项目的根(父)pom.xml文件中加入下面的配置:

<build>  <-- 只需要复制两个 plugin 标签及里面的内容即可,buildplugins 标签是为了更容易理解两个 plugin 标签的放置位置 -->
    <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
                <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>
    </plugins>
</build>

将两个 plugin 标签的内容复制到pom.xml文件后,右键点击pom.xml文件,选择maven --> ReImport(首先要确保该项目是maven项目),maven会自动下载所需的文件(或者使用maven命令:mvn JRebel:generate

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值