我们java后端开发中有时候只是简单的修改了几行代码,项目重启时间又比较耗时,我们配置热部署省时省力。做了多次热部署的配置,有时还是会忘记,特此在这里做下记录。
- pom文件引入maven依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- 热部署必须配置项 -->
<fork>true</fork>
</configuration>
</plugin>
- 设置idea配置:settings-->compiler
- 开启项目运行时自动构建automake: ctrl + shift + a 搜索 registry -> 勾选compiler.automake.allow.when.app.running
到这里,热部署已经配置完成。