1. IDEA开启项目自动编译
File --> Settings --> Build,Execut, Deployment --> Compiler 勾选中左侧的Build Project automatically 和 Compile independent modules in parallel
配置 Compiler
2. IDEA开启项目运行时自动make
Ctrl + Shift + A 搜索命令:registry --> 勾选 compiler.automake.allow.when.app.running
配置 Registry
compiler.automake.allow.when.app.running
3. 配置 Tomcat
两个都选 Update classes and resources
配置 Tomcat
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 勾选中,点击Apply和 OK,重启 IDEA 即可。
手动安装 Jrebel
5. 使用 JRebel
JRebel 仅限 Debug 模式下使用,选择第二个 Debug 按钮即可
JRebel Debug模式下使用
6. 当一个项目使用maven多模块开发时通过上面的配置, 只能自动加载webapp所在的模块, 若想改动其他模块的代码也要自动加载, 需在项目的根(父)pom.xml文件中加入下面的配置:
<build> <-- 只需要复制两个 plugin 标签及里面的内容即可,build 和 plugins 标签是为了更容易理解两个 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)













网友评论