From 464f10e2a3cd543cf33cd94c2d0d5e56d1e2a12d Mon Sep 17 00:00:00 2001 From: Dickson Chow Date: Mon, 30 Jan 2023 18:51:07 +0800 Subject: [PATCH] Add an option parameter to the startCorda gradle task to configure the port number --- buildSrc/src/main/groovy/csde.gradle | 6 +++++- .../src/main/java/com/r3/csde/CordaLifeCycleHelper.java | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/groovy/csde.gradle b/buildSrc/src/main/groovy/csde.gradle index 673ce8f4..0a125c14 100644 --- a/buildSrc/src/main/groovy/csde.gradle +++ b/buildSrc/src/main/groovy/csde.gradle @@ -134,7 +134,11 @@ tasks.register("startCorda") { dependsOn('getDevCordaLite', 'getPostgresJDBC') doLast { mkdir devEnvWorkspace - cordaLifeCycle.startCorda() + // Default port number to be used by Corda 5 workers + // However, note that using port 7000 on macOS may not be able to start the process + // because this port is used by AirPlay by default + def port = Integer.parseInt(project.findProperty("port") ?: "7000") + cordaLifeCycle.startCorda(port) } } diff --git a/buildSrc/src/main/java/com/r3/csde/CordaLifeCycleHelper.java b/buildSrc/src/main/java/com/r3/csde/CordaLifeCycleHelper.java index 12a63dde..a074345d 100644 --- a/buildSrc/src/main/java/com/r3/csde/CordaLifeCycleHelper.java +++ b/buildSrc/src/main/java/com/r3/csde/CordaLifeCycleHelper.java @@ -21,7 +21,7 @@ public CordaLifeCycleHelper(ProjectContext _pc) { } - public void startCorda() throws IOException { + public void startCorda(Integer port) throws IOException { PrintStream pidStore = new PrintStream(new FileOutputStream(pc.cordaPidCache)); File combinedWorkerJar = pc.project.getConfigurations().getByName("combinedWorker").getSingleFile(); @@ -45,6 +45,7 @@ public void startCorda() throws IOException { "-jar", combinedWorkerJar.toString(), "--instanceId=0", + "-p="+port, "-mbus.busType=DATABASE", "-spassphrase=password", "-ssalt=salt",