Rewrite into Groovy so that @DelegatesTo works.
Fix groovy dependency.
Remove unused class.