What's the best way to customise jvmargs of the ko...
# gradle
v
What's the best way to customise jvmargs of the kotlin daemon? Docs recommend using
kotlin.daemon.jvmargs
property in gradle.properties, but how do I use this from command line? For ex. with,
./gradlew bundleDebug -Dorg.gradle.jvmargs="-Duser.language=en -Xmx5g" -Dkotlin.daemon.jvmargs="-Duser.language=fr -Xmx4g"
I see that the Xmx argument that I provided for Kotlin daemon is ignored and instead it's taken from Gradle daemon's jvmargs
Copy code
$ jcmd 26327 VM.command_line
26327:
VM Arguments:
jvm_args: <redacted> -Xmx5g -Dfile.encoding=UTF-8 -Duser.country=IN -Duser.language=en -Duser.variant
java_command: org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.3.3

$ jcmd 26433 VM.command_line
26433:
VM Arguments:
jvm_args: -Xmx5g -Djava.awt.headless=true -D$java.rmi.server.hostname=127.0.0.1 -Dkotlin.environment.keepalive -ea
java_command: org.jetbrains.kotlin.daemon.KotlinCompileDaemon <redacted>
This did the trick:
./gradlew bundleDebug -Dorg.gradle.jvmargs="-Dkotlin.daemon.jvm.options=-Duser.language=fr,-Xmx4g -Duser.language=en -Xmx5g"
kotlin.daemon.jvm.options
is nested inside the
org.gradle.jvmargs
in a comma-separated format. Rest of the arguments are sent as-is to Gradle daemon
t
You need to use
-Pkotlin.daemon.jvmargs
v
ooh got it, thanks! is there any advantage of using
kotlin.daemon.jvmargs
over
kotlin.daemon.jvm.options
except for the way argument is formatted?
t
hmm, for now - no. Up to you what to use. Imho
kotlin.daemon.jvm.options
is more clear what it is for
gratitude thank you 1
374 Views