Hello,
I’m currently using Gradle in a multi-module build. Two of the sub-modules contain their own main methods and need to run concurrently in separate JVMs. My initial solution packaged up both applications into individual executable jar files using the Gradle java plugin. Then application A started application B in it’s own process. Something like this…
public class ServiceManagerProcess implements Runnable {
public static Process _process;
public void run() {
Properties prop = new Properties();
prop.load(ServerPlatformManager.class.getClassLoader()
.getResourceAsStream("services-mgr.properties"));
String java = prop.getProperty("java");
String jarCmd = prop.getProperty("jar-cmd");
String jarFile = prop.getProperty("jar-file");
ProcessBuilder processBuilder = new ProcessBuilder(java, jarCmd, jarFile);
Process _process = processBuilder.start();
...
_process.waitFor();
}
}
Then I came across the Gradle application plugin, and decided it would be better to package everything up as zip files, with the dependencies jarred (rather than multiple executable uber jars).
However, I’m a bit unsure of the best way to transition the startup sequence so that application A starts application B. I think this could be accomplished using the batch file created via the application plugin. Currently each sub-module is zipped into it’s own distribution and contains it’s own batch file.
Ideally it seems like I want both sub-modules in one zip file and the batch file to start both of them. Can this be configured in my build.gradle script? Where would I start?
I could post snippets of my gradle script, but right now the piece that uses the application plugin is pretty vanilla.
Regards,
John