spidasoftware/format extracts the groovy eclipse plugin and provides a command line interface to it.
Instructions:
git clone git@github.com:spidasoftware/format.git && \
cd format/bin && \
./format /path/to/groovy/file
caveat: this project is no longer maintained however still works as of the time of this post