idea实现热部署
1. 在父工程pom.xml文件中添加如下代码:
<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>
2.需要热部署的微服务中添加:
<!--热部署-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
3. 按住快捷键 ctrl + shift + alt + /
3.1 在弹出的快捷栏里,选择第一项:
Registry...
3.2 勾选如下两个选项
compiler.automake.allow.when.app.running
actionSystem.assertFocusAccessFormEdt
4.File -> setting -> build,Execution,Deployment -> Compiler
4.1勾选如下两个选项,如果只勾选上面两个,可以使用快捷键 CTRL + F9, 实现热部署
Automatically show first error in editor
Display notification on build completion
4.2 但是如果把下面两个选项也勾选,可以实现修改完代码就自动热部署
Build project automatically
Compile independent modules in parallel