Picking up on your suggestion, I found this Stackoverflow topic and a post on this very forum where this solution is given:
Per default the system.in of your gradle build is not wired up with the system.in of the run (JavaExec) task. You can do the following:
run{ standardInput = System.in }
After adding it as the last line of my build.gradle
and running gradle <task>
the error is still the same though:
Exception in thread "main" java.util.NoSuchElementException