Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add custom "-Djava" arguments to Grails app?

Say I wanted to run a Grails (2.3+) app with an extra "-Djava.fizz.buzz=3" JVM arg.

Is it as simple as:

grails run-app -Djava.fizz.buzz=3

Or is there special config (say, in BuildConfig.groovy) that would need to take place?

like image 862
AdjustingForInflation Avatar asked Jun 27 '26 19:06

AdjustingForInflation


2 Answers

That should work. And to have access to the arg you just created, you may call System.properties[] anywhere in your code:

if (System.properties['java.fizz.buzz'] == '3') {
    ...
}
like image 181
Cléssio Mendes Avatar answered Jun 30 '26 19:06

Cléssio Mendes


The answer to your question is yes, that will work. JVM args work a bit differently. Both are in the docs about the command line.

like image 36
Gregg Avatar answered Jun 30 '26 19:06

Gregg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!