public static void setSystemPropertiesFromCommandLine()

in client/src/main/java-mvnd/org/mvndaemon/mvnd/client/DefaultClient.java [181:216]


    public static void setSystemPropertiesFromCommandLine(List<String> args) {
        final Iterator<String> iterator = args.iterator();
        boolean defineIsEmpty = false;
        while (iterator.hasNext()) {
            final String arg = iterator.next();
            String val =
                    Environment.MAVEN_DEFINE.removeCommandLineOption(new ArrayList<>(Collections.singletonList(arg)));
            /* not -D or --define and pre define is empty */
            if (val == null && defineIsEmpty) {
                defineIsEmpty = false;
                /* not all of Environment, use arg as pre define value */
                val = maybeDefineCommandLineOption(arg) ? arg : "";
            }
            if (val != null) {
                /* empty -D or --define, next arg is value */
                if (val.isEmpty() && iterator.hasNext()) {
                    defineIsEmpty = true;
                    continue;
                }
                if (val.isEmpty()) {
                    throw new IllegalArgumentException("Missing argument for option " + arg);
                }
                /* This needs to be done very early, otherwise various DaemonParameters do not work properly */
                final int eqPos = val.indexOf('=');
                if (eqPos >= 0) {
                    String k = val.substring(0, eqPos);
                    String v = val.substring(eqPos + 1);
                    System.setProperty(k, v);
                    LOGGER.trace("Setting system property {} to {}", k, v);
                } else {
                    System.setProperty(val, "");
                    LOGGER.trace("Setting system property {}", val);
                }
            }
        }
    }