idea配置SpringBoot热部署之自动Build

一、pom.xml文件导入所需依赖文件,在dependencys结点中添加:

<!--添加热部署-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
            <scope>true</scope>
        </dependency>

二、pom.xml文件build标签进行修改如下

<plugin>
                <!--热部署配置-->
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <!--fork:如果没有该项配置,整个devtools不会起作用-->
                    <fork>true</fork>
                </configuration>
            </plugin>

三、设置IDEA的自动编译:

点击菜单File-Settings-Compiler勾选 Build Project automatically

 四、按快捷键 ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running

 

五。重启IDEA即可生效

原文地址:https://www.cnblogs.com/q149072205/p/12192143.html