I have researched this extensively on the internet but haven't been able to find anything relevant to my situation.
I currently have a project with grails 2.5 and I am using the Intellij 14.1.3.
Since 14.1 Intellij allows the groovy eclipse compiler to be used. I downloaded the appropriate version (2.4.3) of the compiler to use in my project.
I get these errors in classes whenever I try to compile (and it only occurs in spock specs)
2015-07-06 13:35:18,677 [13475148] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: General error during canonicalization: java.lang.NoClassDefFoundError: junit/framework/TestCase
2015-07-06 13:35:18,677 [13475148] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: java.lang.RuntimeException: java.lang.NoClassDefFoundError: junit/framework/TestCase
2015-07-06 13:35:18,677 [13475148] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1257)
Followed by this further down in the stacktrace:
2015-07-06 13:35:18,678 [13475149] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.grails.compiler.injection.test.MockTransformation
2015-07-06 13:35:18,678 [13475149] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
2015-07-06 13:35:18,678 [13475149] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
2015-07-06 13:35:18,678 [13475149] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
2015-07-06 13:35:18,678 [13475149] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
2015-07-06 13:35:18,678 [13475149] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: at java.lang.Class.newInstance(Class.java:383)
2015-07-06 13:35:18,678 [13475149] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:99)
2015-07-06 13:35:18,678 [13475149] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:227)
2015-07-06 13:35:18,678 [13475149] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1221)
2015-07-06 13:35:18,678 [13475149] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: ... 32 more
The errors seem quite straightfoward: a missing class. However if I switch back to the normal compiler, everything works fine.