[GRADLE-1254] JavaExec Task should expose a way to execute java processes in the background. Created: 14/Dec/10 Updated: 08/Feb/17 Resolved: 08/Feb/17 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 0.9-rc-3 |
Fix Version/s: | None |
Type: | Improvement | ||
Reporter: | Erick Dovale | Assignee: | Unassigned |
Resolution: | Duplicate | Votes: | 59 |
Description |
Currently there is no natural way to execute a java process in the background. Here is a chat I had with merscwog in the IRC channel about this topic: <edovale> any of you guys know how can I get the javaexec task not to wait for process termination before returning? |
Comments |
Comment by Mauro Molinari [ 06/Dec/11 ] |
Should be the equivalent of spawn=true in Ant Java task. |
Comment by Luke Daley [ 07/Dec/11 ] |
Related forum issue: http://forums.gradle.org/gradle/topics/does_javaexec_task_support_spawning_the_jvm_in_a_new_process_which_will_outlive |
Comment by Pablo Munoz [ 21/Jun/12 ] |
Are there any updates to this ticket? Can we include in 1.1 release? |
Comment by Adam Murdoch [ 21/Jun/12 ] |
@Pablo, it probably won't make it into the 1.1 release. We'll try and see if we can squeeze it in. There are some pretty simple work-arounds:
def process = ['java', '-cp', 'some-path', 'SomeMainClass', 'arg'].execute() |
Comment by Pablo Munoz [ 22/Jun/12 ] |
Thank you Adam we'll try those out. Please keep us posted. |
Comment by Davide Cavestro [ 06/Feb/14 ] |
Any chance to get this fixed? |
Comment by Endre Stølsvik [ 21/Feb/14 ] |
I would really love this. This is now the second round of searching where I have this exact need. Actually, what I also need, is the ability to fire off a process which spawns threads - and when the main-thread returns, I want the task to be finished. However, the threads run on in the background. This is obviously going to be used for integration tests - whereby I start up e.g. a "self-contained Jetty" in a main method, and then when the application is up, the main method exits, and I can go for the tests. Using ant.java, I can get this "when main method exits, the task is done" feature (by having both fork and spawn = false), but I ran into some other issues then (both that it runs within a restrictive security manager not e,g, allowing MBeans to be registered).. Also using the ant.java, I can spawn it totally, but then I both loose the standard output, and I would need to implement some shaky polling strategy to check if the thing has come up. (Full fork/spawn/disown is also very good in itself - to e.g. on command line do a full build and then spawn the result - and exit Gradle. But when I need the spawn to just exist for the duration of the rest of the build, to interact with it from the rest of the build script for testing, the full fork is not the right solution.) |
Comment by Frederic [ 27/Aug/15 ] |
Comment by Benjamin Muschko [ 15/Nov/16 ] |
As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub. We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to. Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:
We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle! |
Comment by Benjamin Muschko [ 08/Feb/17 ] |
The issue is now tracked on GitHub: https://github.com/gradle/gradle/issues/1367 |