How to set the default jvm args to gradle application plugin?
Support for JVM arguments was added in Gradle 1.7: https://docs.gradle.org/current/userguide/application_plugin.html#configureApplicationDefaultJvmArgs
For example, for setting file.encoding
, you can do:
applicationDefaultJvmArgs = ['-Dfile.encoding=utf-8']
There is currently no special support for setting DEFAULT_JVM_OPTS
. However, you can do something like:
startScripts {
doLast {
unixScript.text = unixScript.text.replace('DEFAULT_JVM_OPTS=""', 'DEFAULT_JVM_OPTS="-Dfile.encoding=utf-8"')
}
}
You may want to do something similar for windowsScript
.