What are possible causes for `applicationDefaultJv...
# gradle
m
What are possible causes for
applicationDefaultJvmArgs
not be passed to the program? I’m trying to pass a variable from gradle to Ktor like this:
Copy code
application {
  applicationDefaultJvmArgs = listOf("-Dzeals.version=7.7.7")
}
but in Ktor
System.getProperty("zeals.version")
returns
null
t
Gradle
ApplicationPlugin
sets as a convention value of
applicationDefaultJvmArgs
to the
JavaExec.jvmArguments
task input. The only way it could be overwritten - is that you are calling
JavaExec.jvmArguments.set()
or
JavaExec.jvmArguments.add()
down the build script.
You could also increase Gradle log level to info to check the final arguments passed from
JavaExec
m
Hmm it still happens even if I put the application block at the bottom of the script
Hmm I can’t find JavaExec in the build output logs even after setting the log level to debug through gradle.properties
I’m using Ktor plugin to run if that’s relevant
t
how do you run Ktor application?
m
Using the Ktor run config. Here’s my configuration:
I’m suspecting Ktor because the code in the opening post works in a Kotlin/gradle hello world project.
t
This configuration runs application not via
JavaExec
task, but invoking compiled code directly. So you need to add here
-Dzeals.version=7.7.7
into "program arguments"
1