Allow passing additional jvm args to the daemon, fixes #174

This commit is contained in:
Guillaume Nodet
2020-11-06 09:58:16 +01:00
committed by Peter Palaga
parent a6e4c47aaa
commit 97cde29e84
3 changed files with 17 additions and 0 deletions

View File

@@ -258,6 +258,15 @@ public class DaemonConnector {
if (parameters.property(Environment.DAEMON_DEBUG).asBoolean()) { if (parameters.property(Environment.DAEMON_DEBUG).asBoolean()) {
args.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000"); 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 // memory
String minHeapSize = parameters.minHeapSize(); String minHeapSize = parameters.minHeapSize();
if (minHeapSize != null) { if (minHeapSize != null) {

View File

@@ -199,6 +199,10 @@ public class DaemonParameters {
return property(Environment.DAEMON_MAX_HEAP_SIZE).asString(); 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 * @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`. * unless the user passes his own `-T` or `--threads`.

View File

@@ -113,6 +113,10 @@ public enum Environment {
* JVM options for the daemon * JVM options for the daemon
*/ */
DAEMON_MAX_HEAP_SIZE("daemon.maxHeapSize", null, "2G", true), 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 * JVM options for the daemon
*/ */