I have a standard java project layout and in some of my tests i have System.getenv("my_var"). I'd like to do run my tests using command line (from CI server) and pass the value of env var. Something like
./gradlew test -Dmy_var=xyz
but of course, this one doesn't work as tests are run by different jvm. so what's the exact command to pass the env var? i would prefer not to change my build scripts, create new tasks etc. i just want to pass env var via commandline. how can i do it?
found it. as simple as:
my_var=xyz ./gradlew test
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With