diff --git a/client/src/main/java/org/mvndaemon/mvnd/client/DefaultClient.java b/client/src/main/java/org/mvndaemon/mvnd/client/DefaultClient.java index 9ef484db9..83ecc1707 100644 --- a/client/src/main/java/org/mvndaemon/mvnd/client/DefaultClient.java +++ b/client/src/main/java/org/mvndaemon/mvnd/client/DefaultClient.java @@ -71,6 +71,16 @@ public static void main(String[] argv) throws Exception { } else { throw new IllegalArgumentException("-l and --log-file need to be followed by a path"); } + + } else if (arg.startsWith("-D")) { + /* This needs to be done very early, otherwise various DeamonParameters do not work properly */ + final int eqPos = arg.indexOf('='); + if (eqPos >= 0) { + System.setProperty(arg.substring(2, eqPos), arg.substring(eqPos + 1)); + } else { + System.setProperty(arg.substring(2), ""); + } + args.add(arg); } else { if (!batchMode && ("-B".equals(arg) || "--batch-mode".equals(arg))) { batchMode = true; 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 14b405f22..5641e10de 100644 --- a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java +++ b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java @@ -174,14 +174,18 @@ public enum Environment { MVND_DUPLICATE_DAEMON_GRACE_PERIOD("mvnd.duplicateDaemonGracePeriod", null, "10 seconds", true, true), ; - static Properties properties = System.getProperties(); + static Properties properties; public static void setProperties(Properties properties) { Environment.properties = properties; } public static String getProperty(String property) { - return properties.getProperty(property); + Properties props = Environment.properties; + if (props == null) { + props = System.getProperties(); + } + return props.getProperty(property); } private final String property;