From 204c24717461fcc9aa711bb0a1322e31c562835e Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Fri, 6 Nov 2020 09:58:16 +0100 Subject: [PATCH] Allow passing additional jvm args to the daemon, fixes #174 --- .../java/org/jboss/fuse/mvnd/client/DaemonConnector.java | 9 +++++++++ .../org/jboss/fuse/mvnd/client/DaemonParameters.java | 4 ++++ .../java/org/jboss/fuse/mvnd/common/Environment.java | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonConnector.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonConnector.java index 53289a8c6..2a8d6e09a 100644 --- a/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonConnector.java +++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonConnector.java @@ -258,6 +258,15 @@ private Process startDaemon(String uid) { if (parameters.property(Environment.DAEMON_DEBUG).asBoolean()) { args.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000"); } + // jvm args + String jvmArgs = parameters.jvmArgs(); + if (jvmArgs != null) { + for (String arg : jvmArgs.split(" ")) { + if (!arg.isEmpty()) { + args.add(arg); + } + } + } // memory String minHeapSize = parameters.minHeapSize(); if (minHeapSize != null) { diff --git a/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonParameters.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonParameters.java index 812b62824..f90e67abb 100644 --- a/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonParameters.java +++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonParameters.java @@ -197,6 +197,10 @@ public String maxHeapSize() { return property(Environment.DAEMON_MAX_HEAP_SIZE).asString(); } + public String jvmArgs() { + return property(Environment.DAEMON_JVM_ARGS).asString(); + } + /** * @return the number of threads (same syntax as Maven's {@code -T}/{@code --threads} option) to pass to the daemon * unless the user passes his own `-T` or `--threads`. diff --git a/common/src/main/java/org/jboss/fuse/mvnd/common/Environment.java b/common/src/main/java/org/jboss/fuse/mvnd/common/Environment.java index 6d7ef4053..3decc805c 100644 --- a/common/src/main/java/org/jboss/fuse/mvnd/common/Environment.java +++ b/common/src/main/java/org/jboss/fuse/mvnd/common/Environment.java @@ -113,6 +113,10 @@ public String asCommandLineProperty(String value) { * JVM options for the daemon */ DAEMON_MAX_HEAP_SIZE("daemon.maxHeapSize", null, "2G", true), + /** + * Additional JVM args for the daemon + */ + DAEMON_JVM_ARGS("daemon.jvmArgs", null, "", true), /** * JVM options for the daemon */