I\'m trying to get my gradle builds to prompt at the console for a password using examples from stack overflow
When I have a statment such as:
def pa
Ok, the reason why this didn't work was silly, but just in case anyone else comes across it I thought I'd post.
I was running the task through android studio and didn't realise that the console object would always be null. When running from the command line the "command" object isn't null and it works ok.
You can execute your script also with:
-Dorg.gradle.daemon=false
password System.console() != null ? System.console().readLine("\ password: ") : ""
For some reason, running gradle in daemon mode causes a null console object. If you specify the appropriate command line flag,
./gradlew assembleRelease --no-daemon
it'll work.