【IDEA2022版本设置热部署】

IDEA2022版本设置热部署

  1. 开启IDEA的自动(静态)编译

    具体步骤:打开顶部工具栏 File -> Settings -> Build,Execution,Deployment -> Compiler 然后勾选 Build project automatically
    在这里插入图片描述

  2. 开启IDEA的自动(动态)编译

    具体步骤:打开顶部工具栏 File -> Settings -> Advanced Settings -> Compiler -> 然后勾选 Allow auto-make to start even if developed application is currently running
    在这里插入图片描述

  3. 开启IDEA的热部署策略(非常重要)

    具体步骤:点击Edit Configurations…进入
    选择Modif options -> On ‘Updata’ actrion -> Update classes and resources
    在这里插入图片描述

  4. 在pom.xml文件中导入热部署插件

    <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-devtools</artifactId>
       <scope>runtime</scope>
    </dependency>
    
    <plugin>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-maven-plugin</artifactId>
       <configuration>
           <fork>true</fork><!--必须添加这个配置-->
           <addResources>true</addResources>
           <excludes>
               <exclude>
                   <groupId>org.projectlombok</groupId>
                   <artifactId>lombok</artifactId>
               </exclude>
           </excludes>
       </configuration>
    </plugin>
    

猜你喜欢

转载自blog.csdn.net/u011277745/article/details/129445604
今日推荐