在Spring Boot项目添加了devtools的前提下,STS只需要简单的保存文件就可以触发重启,非常方便简单。但是Intellij IDEA还需要Ctrl+F9构建项目才行,而且如果使用Gradle的话会调用gradle的build任务,速度更慢,调试体验很受影响。请问有什么插件之类的可以让idea像STS那样保存文件就可以快速触发Spring Boot的重启吗?
另外其实如果Gradle守护进程活着的话Gradle构建也并不算慢。但是不知道是不是我内存捉急的原因,gradle守护经常这次构建,创建了守护进程,然后过几分钟守护进程就死了。之后下次构建项目还得重新启动守护进程,无形中浪费了几十秒时间。有没有啥办法能让Gradle deamon活得久一点?
迷茫2017-04-18 10:58:15
Gradle has not been studied, let me tell you how to operate it using maven, and the subject of the question can draw inferences
Introducing spring devtools
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
Turn on automatic compilation
Press ctrl + shift + a
on the idea interface and search for registry
Open compiler.automake.allow.when.app.running
Enjoy the pleasure of debugging again
You can even install a plug-in for chrome to automatically refresh the page when the page is modified
伊谢尔伦2017-04-18 10:58:15
@FullStackDeveloper's method can only do simple hot swap.
If you want to do real hot deployment, you can use JRebel.
Install JRebel plugin in Intellij
Go to MyJRebel to get the registration code (this registration code is provided to the open source community for free)
Fill in the registration code and then use JRebel to launch your application.
Every time you change the code, just rebuild it.
]