Is it possible to specify Java System Properties when starting Groovy from the command line

Equivalent to java -Dprop="abc" app , but using groovy, for example groovy -Dprop="abc" app.groovy

Basically the same question was asked here , but the negative answers there are relatively old. Does anything new support this since 2007?

+4
source share
1 answer

Sure; It works as is:

 $ cat sysenv.groovy println System.getProperty("wat") $ groovy -Dwat="hello" sysenv.groovy hello 
+6
source

Source: https://habr.com/ru/post/1380824/


All Articles