I'm trying to run a ./gradlew script. Inside my build.gradle, I have a variable that takes value from the environment variable
def username = System.getenv('USERNAME')
print username
I've exported the environment variable by running export USERNAME=someusername before I run the ./gradlew script
The result of print username is always null. I use both IntelliJ and VS Code and run the ./gradlew script from the built-in zsh terminal.
Did I miss any setup? Previously before my Mac was formated, things go well. But after it was formatted, I just started to do Java again and install everything (JDK, IntelliJ). But suddenly I got this kind of result.
The environment is likely cached by the Gradle daemon. Force the daemon to stop with this command:
./gradlew --stop
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