Detaching Process

I am currently experimenting with the gradle plugin api, to explore the possibility of tasks for hot code replacement. I like to develop in vim and the lack of hot code replacement is the main thing preventing me from developing java exclusively in vim. There is a plugin for ant that supports this, hotswap.

Is is possible to detach a process from gradle? I can get a process to execute using the 'JavaExecHandleBuilder’s and ‘ExecHandle’ but the process blocks gradle until it exits.

There appears to be a detached state in ‘ExecHandleState’ so I was wondering how one invokes it?

I tried starting the process in a seperate thread but this thread is killed when gradle exits.

If it is not possible, would it effect gradle negatively to have two instances working in the same directory? One blocked and another one modifying the class files?

Hi James,

There’s no public API for detaching processes.

You can run two Gradle builds in the same directory, but you have to make sure that the two builds don’t stomp on each other (i.e. don’t run ‘clean’ while one build is running ‘compile’). All of Gradle’s machinery is multi process safe though. 

You might like to look at the Gradle “Spawn” and “Watch” plugins. Google searches should pull that up.