"Stop logic" in a JavaExec task

So I found a gradle plugin written in Kotlin that really helps me out a lot when debugging.
The problem is, that the plugin, or in particular, the run task (which is a JavaExec) quits the underlying Java application that gets run forcefully, not with a SIGINT (so basically a Ctrl+C).

The application that gets run by the task has the ability to gracefully stop when “stop” gets sent into the console or if there is a SIGINT sent to it. The task does not do that when stopping it from the IntelliJ interface.
Is there a way to add a kind of stop logic, so the process gets its SIGINT or stop command and has the time to gracefully shut down?

(For context, the exact gradle plugin I’m talking about is here)