我在互联网上对此进行了广泛的研究,但未能找到与我的情况相关的任何内容。
我目前有一个grails 2.5的项目,我使用的是Intellij 14.1.3。
自14.1以来,Intellij允许使用groovy eclipse编译器。我下载了适合我的项目使用的编译器版本(2.4.3)。
每当我尝试编译时,我都会在类中得到这些错误(并且它只出现在spock规范中)
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)
在堆栈跟踪中进一步向下:
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
这些错误看起来很平坦:缺少课程。但是,如果我切换回普通编译器,一切正常。