Error: cannot find symbol class GroovyTestCase
Installed JetGroovy 1.5.14981 in IDEA 7.0.3 build 7444, Mac OS X 10.4.11. Have Groovy and Grails configured to point to Groovy 1.5 and Grails 1.0.1. Have Groovy and Grails configured as global libraries. When I go to run the Grails application, I get errors trying to compile the test classes Notice the error is on the generated java and not the Groovy file. If I do a Goto Declaration on GroovyTestCase the correct class file is found by IDEA.
Information:Compilation completed with 11 errors and 0 warnings
Information:11 errors
Information:0 warnings
/Users/mhusby/Library/Caches/IntelliJIDEA70/compiler/iWine.iWinefae7ff5d/.generated/Groovy_to_java_source_code_generator/iWine.fae7fefa/test/BottleControllerTests.java
Error:Error:line (1)cannot find symbol class GroovyTestCase
/Users/mhusby/Library/Caches/IntelliJIDEA70/compiler/iWine.iWinefae7ff5d/.generated/Groovy_to_java_source_code_generator/iWine.fae7fefa/test/SupplierTests.java
Error:Error:line (1)cannot find symbol class GroovyTestCase
/Users/mhusby/Library/Caches/IntelliJIDEA70/compiler/iWine.iWinefae7ff5d/.generated/Groovy_to_java_source_code_generator/iWine.fae7fefa/test/WineTests.java
Error:Error:line (1)cannot find symbol class GroovyTestCase
/Users/mhusby/Library/Caches/IntelliJIDEA70/compiler/iWine.iWinefae7ff5d/.generated/Groovy_to_java_source_code_generator/iWine.fae7fefa/test/ProducerTests.java
Error:Error:line (1)cannot find symbol class GroovyTestCase
/Users/mhusby/Library/Caches/IntelliJIDEA70/compiler/iWine.iWinefae7ff5d/.generated/Groovy_to_java_source_code_generator/iWine.fae7fefa/test/CellarOwnerTests.java
Error:Error:line (1)cannot find symbol class GroovyTestCase
/Users/mhusby/Library/Caches/IntelliJIDEA70/compiler/iWine.iWinefae7ff5d/.generated/Groovy_to_java_source_code_generator/iWine.fae7fefa/test/ProducerControllerTests.java
Error:Error:line (1)cannot find symbol class GroovyTestCase
/Users/mhusby/Library/Caches/IntelliJIDEA70/compiler/iWine.iWinefae7ff5d/.generated/Groovy_to_java_source_code_generator/iWine.fae7fefa/test/WineControllerTests.java
Error:Error:line (1)cannot find symbol class GroovyTestCase
/Users/mhusby/Library/Caches/IntelliJIDEA70/compiler/iWine.iWinefae7ff5d/.generated/Groovy_to_java_source_code_generator/iWine.fae7fefa/test/BottleTests.java
Error:Error:line (1)cannot find symbol class GroovyTestCase
/Users/mhusby/Library/Caches/IntelliJIDEA70/compiler/iWine.iWinefae7ff5d/.generated/Groovy_to_java_source_code_generator/iWine.fae7fefa/test/CellarOwnerControllerTests.java
Error:Error:line (1)cannot find symbol class GroovyTestCase
/Users/mhusby/Library/Caches/IntelliJIDEA70/compiler/iWine.iWinefae7ff5d/.generated/Groovy_to_java_source_code_generator/iWine.fae7fefa/test/SupplierControllerTests.java
Error:Error:line (1)cannot find symbol class GroovyTestCase
/Users/mhusby/Library/Caches/IntelliJIDEA70/compiler/iWine.iWinefae7ff5d/.generated/Groovy_to_java_source_code_generator/iWine.fae7fefa/test/WineCellarTests.java
Error:Error:line (1)cannot find symbol class GroovyTestCase
Please sign in to leave a comment.
So is the groovy file green? weird...
I am getting the same problem too where my test classes are not able to find the GroovyTestCase class. If I do cntl-N I can find the class. If I do alt-f1 with the cursor in the class body of the class (editor pane) and chose 1, It locates the class in the groovy lib area c:\groovy-1.5.4\groovy-1.5.4.jar. My libraries are defined in my setup ... but for some reason I can seem to get this to resolve as well.
Be sure to include the library in your module. Probably groovy facet is not attached to the module.
I started getting exactly same error.
When trying to run the app Grails/Idea is generating Java files, e.g. RaceTest.java, which extend GroovyTestCase. The class can be seen in the groovy-1.5.4.jar but the environment is not picking it up when trying to compile the java file.
Very irritating, it comes and goes depending which tutorial I try - not clear what the pattern is yet.
Have you looked at your module setup according to my previous comment? Could you please post a screenshot of your module's dependencies?
I suspect I'm doing something wrong with attaching groovy/grails libraries to module. Why is not this done automatically when you set up Grails facet?
I tried both Module/Dependencies and Libraries to attach the Grails and Groovy lib.
I attach a screenshot which may give you some clues.
Thanks,
Karel
Attachment(s):
ScreenIJI.zip
Actually a screenshot of your module dependencies would help me better:)
Thanks Eugene
New screenshot attached.
Karel
Attachment(s):
ScreenIJI2.zip
Somehow attaching Grails facet does not attach a GRAILS library to your module. Do you have grails configured globally in Settings/Groovy&Grails?
Yes
D:\Program Files\Groovy\Groovy-1.5.4
D:\Program Files\Grails\grails-1.0.2\grails
One of my older tutorial seems to be working fine.
All the new once, even trivial tests give the same error.
Thinks started to go wrong when I moved all my IJI grails projects into a new folder - this may be a clue?
Thanks,
Karel
I was just having this same problem, Groovy 1.5.4, Grails 1.0.2.
It all went away when I removed an old copy of Groovy (1.5.2) from my machine and changed all the env vars. In particular, GROOVY_HOME and PATH (windows).
Note that my project settings pointed to Groovy 1.5.4 while my GROOVY_HOME and PATH variables pointed to the older copy. So I suspect that somewhere in the execution path the env vars are used rather than the project settings, but that's completely uninformed speculation.
Best
Erick