From afcc67ef3e037edf155aec46827afc14beaba6a3 Mon Sep 17 00:00:00 2001 From: Peter Palaga Date: Tue, 15 Dec 2020 14:34:39 +0100 Subject: [PATCH] A new daemon is always started on Java 8 #266 #260 #261 --- .../java/org/mvndaemon/mvnd/client/DaemonConnector.java | 1 + .../main/java/org/mvndaemon/mvnd/common/Environment.java | 7 ++++++- daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/src/main/java/org/mvndaemon/mvnd/client/DaemonConnector.java b/client/src/main/java/org/mvndaemon/mvnd/client/DaemonConnector.java index 880489f9b..74963bb14 100644 --- a/client/src/main/java/org/mvndaemon/mvnd/client/DaemonConnector.java +++ b/client/src/main/java/org/mvndaemon/mvnd/client/DaemonConnector.java @@ -328,6 +328,7 @@ private Process startDaemon(String uid) { } Environment.MVND_HOME.addCommandLineOption(args, mvndHome.toString()); + Environment.MVND_JAVA_HOME.addCommandLineOption(args, parameters.javaHome().toString()); Environment.LOGBACK_CONFIGURATION_FILE .addCommandLineOption(args, parameters.logbackConfigurationPath().toString()); Environment.MVND_UID.addCommandLineOption(args, uid); diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java index e8c810fa8..a39fedc04 100644 --- a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java +++ b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java @@ -224,7 +224,12 @@ public enum Environment { /** * Internal property to tell the daemon the width of the terminal */ - MVND_TERMINAL_WIDTH("mvnd.terminalWidth", null, 0, OptionType.INTEGER, Flags.INTERNAL); + MVND_TERMINAL_WIDTH("mvnd.terminalWidth", null, 0, OptionType.INTEGER, Flags.INTERNAL), + /** + * Internal property to tell the daemon which JAVA_HOME was used to start it. It needs to be passed explicitly + * because the value may differ from what the daemon sees through System.getProperty("java.home"). + */ + MVND_JAVA_HOME("mvnd.java.home", null, null, OptionType.PATH, Flags.INTERNAL); static Properties properties; diff --git a/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java b/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java index de87aa7e8..f240a0c09 100644 --- a/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java +++ b/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java @@ -129,7 +129,7 @@ public Server() throws IOException { } long cur = System.currentTimeMillis(); info = new DaemonInfo(uid, - Environment.JAVA_HOME.asString(), + Environment.MVND_JAVA_HOME.asString(), Environment.MVND_HOME.asString(), DaemonRegistry.getProcessId(), socket.socket().getLocalPort(),