If you get this error, check if there’s another (wrong) groovy version on your classpath.
For me this happened in IntelliJ because I had @Grab’ed a third party library that depended on an older groovy version, and IntelliJ adds @Grab’ed dependencies if you have the “Add –classpath …” checkbox in the launch config checked.