Intellij IDEA 使用jrebel运行spring-boot并实现自动编译进行热部署

Fear not that the life shall come to an end, but rather fear that it shall never have a beginning.
不要害怕你的生活将要结束,应该担心你的生活永远不会真正开始。

在使用jrebel运行spring-boot的时候,会发现一个很棘手的问题,就是项目不能自动编译,不能自动编译就不能实现热部署。(使用jar包方式运行的时候)
那么我们就要解决自动编译的问题,首先:

1、pom文件中加入依赖,
  <!--热部署-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
  <!-- Package as an executable jar -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork><!--注意要修改这里-->
                </configuration>
            </plugin>
        </plugins>
    </build>
2、勾选上Build project automatically
3、按组合键 Command+Shift+A,选择Registry
4、勾选上compiler.automake.allow.when.app.running
·5、重新启动idea试试吧!
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容