Gradle javaexec task is ignoring jvmargs
-
23-12-2019 - |
Question
I am trying to run my app using a Gradle javaexec task. However, jvmargs and args are not passed to the command execution. Why?
task runArgoDev(type: JavaExec) {
main = "org.app.ArgoDevRunner"
classpath = configurations.testRuntime
project.ext.jvmargs = ['-Xdock:name=Argo', '-Xmx512m', '-Dfile.encoding=UTF-8', '-Dapple.awt.textantialiasing=on', '-ea']
project.ext.args = ['-initParameter', 'implicit-scrollpane-support=true']
}
Solution
Above code doesn't have the desired effect because it sets extra properties on the project
object, instead of configuring the task. Correct is jvmArgs = ...
and args = ...
. (It's also possible to omit =
, [
, and ]
.)
OTHER TIPS
Here is example, to pass program args and jvmargs to run task in gradle.
run {
args 'server', 'test.yml'
jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005'
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow