Actually groovyc comes with a builtin formatter (kind of). If you set the environment variable JAVA_OPTS
to -Dantlr.ast
and run groovyc test.groovy
a file called test.groovy.pretty.groovy is generated.
But be aware: From what I found in the internet about this, this formatter is not configurable and strips comments!