IDEA怎么用Devtools热部署

495 阅读1分钟

IDEA怎么用Devtools热部署

1. Adding devtools to your project

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <scope>runtime</scope>
    <optional>true</optional>
</dependency>

2. Adding plugin to your pom.xml

<!-- 下段配置我们粘贴进聚合父类总工程的pom.xml里-->
 
<build>
    <finalName>你自己的工程名字</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <fork>true</fork>
                <addResources>true</addResources>
            </configuration>
        </plugin>
    </plugins>
</build>

3. Enabling automatic build

image.png

image.png

4. Update the value of

image.png

image.png 注意:

如果IDEA是2021.2后的版本,则上面的compiler.automake.allow.when.app.running配置在高级设置中:

image.png

5. 重启IDEA