在真实调试中,我们需要不断的调试程序,现在我希望,只要修改了文件,就自动编译重启,而不需要我们手动进行重启
添加devtools依赖到子工程中
注意:添加到子工程中即可,不需要在父工程中添加
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
添加插件到父工程的pom文件中
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>
使能自动编译
- File->settings
- 搜索compile,将A,B,C,D开头的全部勾选
设置更新值
按ctril+shift+Alt + /
, 选择Registry
勾选
compiler.automake.allow.when.app.running
actionSystem.assertFocusAccessFromEdt
重启IDEA并测试
在IDEA2020中默认情况下,修改文件不会立即从起,而需要过一会自动重启,你可以按ctril+F9
立即重启