https://code-maven.com/groovy-read-from-stdin
I read your article at the URL above, and can confirm that from within an IDE (IntelliJ IDEA), when running the code in a "Run" window, System.console() returns null, and thus readLine is not available on it. System.in.newReader().readLine() does work fine in this environment.