It is often desired to declare constants at the top of a script that can be referenced anywhere else in the script. In Groovy, it seems that if you declare a constant using fin
In Groovy 1.8+, you can achieve this using the @Field annotation:
import groovy.transform.Field @Field final String MY_CONSTANT = 'constant' def printConstant() { println MY_CONSTANT } printConstant()