IDEA:热部署

近期新接触了一个项目,IDEA开启自动编译后热部署也不生效.很纳闷儿,因为之前的项目是可以热部署的.后来搜了几篇博客之后终于解决了问题,于是有了这篇博客.

1、添加maven依赖

       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional> <!-- 这个需要为 true 热部署才有效 -->
            <scope>true</scope>
       </dependency>

2、插件配置

           <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <!-- 没有该配置,devtools 不生效 -->
                    <fork>true</fork>
                    <addResources>true</addResources>
                </configuration>
           </plugin>

3.开启IDEA的自动编译(如果已经设置过了就没必要往下看了)

(1) File---Settings---Compiler---Build Project automatically

 或者:快捷键 Ctrl+Alt + S ---Compiler---Build Project automatically

(2) Ctrl + Shift + Alt + /, 选择Registry,然后勾上 Compiler autoMake allow when app running

 

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值