I'm seeing this at least when I load scripts from another - I refer to these as subscripts. My usual pattern is to wrap all the code in there into a class, such as:
final def steps
this.steps = steps
I've only recently started doing this, to better share code between several scripts. The pattern has been working over the last few weeks but suddenly stopped working, I believe yesterday. I get errors along the lines of:
groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: globals for class: setupSubScript
(in this particular example, the first property was called globals)
As far as I can see that is perfectly valid groovy. Commenting or deleting the final makes it work.