Backport yaml-0.5 support for groovy

This is a backport of #691.