$ gradle -v
------------------------------------------------------------
Gradle 2.4
------------------------------------------------------------
Build time: 2015-05-05 08:09:24 UTC
Build number: none
Revision: 5c9c3bc20ca1c281ac7972643f1e2d190f2c943c
Groovy: 2.3.10
Ant: Apache Ant(TM) version 1.9.4 compiled on April 29 2014
JVM: 1.8.0_40 (Oracle Corporation 25.40-b25)
OS: Mac OS X 10.10.3 x86_64
A typical scenario for Spring Boot users is to launch the application using gradle bootRun
. The build remains in a perpetually running state, e.g. you’ll see:
> Building 80% > :bootRun
until the application is killed, usually with a ^C.
If no Gradle Daemon had been running previously, one will see the typical message on first invocation of bootRun
:
$ gradle bootRun
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
However, when the bootRun task is killed via ^C, the associated GradleDaemon process gets killed as well. This is of course undesirable given subsequent gradle bootRun
invocations must incur the overhead of launching a new daemon process.
A typical workflow is to run gradle bootRun
, make changes to code, ^C and re-run gradle bootRun
to pick up the new changes. Anyone developing a Spring Boot-based application would go through this cycle dozens of times per day, so the overhead of killing and re-creating the daemon is really felt. Indeed, this problem virtually eliminates the benefits of the daemon altogether.
I do not recall this being a problem until relatively recently. That is, I recall building Spring Boot-based applications in the past, and using gradle bootRun
as described above without seeing the daemon process killed and re-launched on each invocation.
I thought this behavior might be new to Gradle 2.4, but upon reverting my build to Gradle 2.3, I see the same issue. What is different is that Gradle 2.4 emits the “Starting a new Gradle Daemon” message, whereas versions 2.3 and earlier did not. Perhaps this has always been a problem, and I’m just now “feeling” it simply because I see the message and know that it should not be so.
In any case, this seems like a bug. Can killing a running build be decoupled from killing its daemon?
Thanks.