SpringCloud笔记-热部署Devtools配置全流程-idea2021无compiler.automake.allow.when.app.running解决方案

SpringCloud笔记-热部署Devtools配置

修改后端代码时,需要重新启动项目应用新的代码。为了减少重启项目的麻烦,我们可以配置热部署。

  1. 配置devtools到子工程的pom.xml:
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <scope>runtime</scope>
    <optional>true</optional>
</dependency>
  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>
  1. 修改idea设置,setting→Build,Execution,Deployment→Compiler勾选如下四个设置
    请添加图片描述

  2. 注册设置

    1. ctrl+shift+alt+/”唤醒面板,点击注册
      请添加图片描述

    2. 勾选该选项,idea2021版本无compiler.automake.allow.when.app.running,我们需要多做下面一步设置
      请添加图片描述

    3. settings→advanced settings 勾选下图内容,与勾选compiler.automake.allow.when.app.running是等价的。
      请添加图片描述

  3. 重启idea,热部署配置完成。


版权声明:本文为qq_41980872原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。