I can't get static imports to work in Groovy. Is this supposed to work?
(I'm running Groovy 1.7.4 on Windows)
Constants.groovy:
package foo
class Constants {
static final PI = 3.14
}
Test.groovy:
package foo
import static foo.Constants.PI
class Test {
static main(args) {
println("pi=" + PI)
}
}
EDIT: Both files are stored in the same directory "foo".
When I try to run this I get:
groovy -cp . foo\Test.groovy
Caught: groovy.lang.MissingPropertyException: No such property: PI for class: foo.Test
at foo.Test.main(Test.groovy:6)