I am trying to set interpreterMode
in groovysh. I open up groovysh
and execute set interpreterMode
, but then when I try to use def x=1
, x
does not get set:
groovy:000> set interpreterMode
groovy:000> set
Preferences:
interpreterMode=true
groovy:000> def x=2
===> 2
groovy:000> print x
ERROR groovy.lang.MissingPropertyException:
No such property: x for class: groovysh_evaluate
at groovysh_evaluate.run (groovysh_evaluate:2)
...
groovy:000>
What am I doing wrong?
interpreterMode
was added in Groovy 2.4, so while you are correctly setting the preference, the Groovy shell does nothing with it. You can set anything as a preference:
groovy:000> set foo
groovy:000> set
Preferences:
foo=true