Your code doesn't work because you are using the wrong naming conventions. You should write the class with a capital V. This way the Groovy shell knows you are referring to a class, instead of a variable, in case the Groovy cannot determine it.
This is what you really want:
groovy:000> class Vars {
groovy:001> static int x = 1
groovy:002> }
===> true
groovy:000> Vars.x
===> 1
Hope that helps!