Different results compiling Groovy in IDEA vs compiling on command line?

Using IDEA with the JetGroovy plugin, if I compile (CtrlShiftF9) some Groovy code containing an error (an undefined variable named foobar), I see the message "Compilation completed successfully" in the status bar at the bottom of the IDEA window.

If I try to compile the same code (with the undefined variable "foobar"), using groovyc on the command line, I get the following error message (which I expect to see):

... Main.groovy: 6: the name foobar doesn't refer to a declared variable or class ...

So, why don't I see any compiler error output when I compile in IDEA?

When I try to run my code in IDEA, I get the following error output in the run window:

Exception in thread "main" groovy.lang.MissingPropertyException: No such property: foobar for class: GroovyTest

Permanently deleted user

It seems strange that the compiler reports unresolved variable. Groovy being dynamic, that should not be an error. Could you post an example of the code that exhibits the problem? And also are you sure you use the same version of groovyc?


Sorry, this was my mistake. I'm new to Groovy and didn't yet know that apparently "def" is required in static methods, but not instance methods.

For example, this code compiles fine, unless you remove the "def" before "foobar1":

class Main {
static void main(args) {
// def required because of static scope
def foobar1 = 1
new Main().run(args)
void run(args) {
// def not required
foobar2 = 2

The difference in compile results between IDEA and groovyc was my fault. I wasn't careful enough to make sure I was testing exactly the same code -- the two test files differed in whether the method being considered was static or not.