Issue debugging Groovy unit tests in a Grails app.

I click on the debug-as on a groovy test case, and I keep getting this error:

Information:Compilation completed with 4 errors and 0 warnings
Information:4 errors
Information:0 warnings
C:\Documents and Settings\MKnuts6173c\.IntelliJIdea90\system\compiler\divr.divree47e8ff\.generated\groovyStubs\divree47e8ff\divr-grailsPlugins\production\grails\plugin\springcache\web\GrailsFragmentCachingFilter.java
    Error:Error:line (3)cannot find symbol class PageFragmentCachingFilter
    Error:Error:line (12)cannot find symbol class PageInfo
    Error:Error:line (16)cannot find symbol class PageInfo
    Error:Error:line (20)cannot find symbol class PageInfo




I have looked at my Grails User Lib and ehcache 2.0.1 is there, and project builds fine outside of IDEA, but I can not build, or debug Groovy.

I just upgraded to 9.0.2 and I still have this issue.

I also deleted C:\Documents and Settings\MKnuts6173c\.IntelliJIdea90\system\compiler\divr.\* and restarted but I still can not run


I then removed Spring CACHE, but I still have this issue.
25 comments

Is there anything i can submit to have you look into this? I really need to be able to debug!

0

If you run the test as a Grails test, you can just uncheck the 'Make
before run' option in the run configuration.

Do you have the PageFragmentCachingFilter class in your project's
dependencies, can you find it by Ctrl+N? In which jar is it located?

0

I'm having a similar issue with Maia IU-95.54 and Grails 1.2.2. I moved some classes into a different package in my grails app and now I can't run tests in IDEA. I get compilation errors on some groovyStubs around the keyword "transient" (I do have some transient methods on my grails domain classes). Deleting the project directory (.idea) and recreating doesn't seem to help.

is there something I'm missing?

0

Could you post both the original Groovy fragment and the generated Java
stub fragment which causes the compilation to fail?

0

Thanks Peter. Some background might help. This all worked fine last week until I moved a few classes into a different package.

Here is relevant bits of the the original groovy class:

class User implements PersonDisplay {

    Person person

    static transients = ['displayName']

    String legalNameOverride

    transient String getLegalName() {legalNameOverride ?: person.legalName}


     /* .......... */

}

Here is a line in the generated stub that errors out ("modifier transient not allowed here"):

public class Person implements com.example.PersonDisplay , groovy.lang.GroovyObject {

  public transient java.lang.String getLegalName() {

    return null;

  }



               /* ...... */

}

Cheers,
Dan

0

Please try the attached Groovy plugin version, it should fix the problem



Attachment(s):
Groovy.zip
0

What does this patch do and how do I install it?

0

package net.sf.ehcache.constructs.web.filter;

This is just part of Grails and this worked before.

0

Your symptoms are different, so it probably won't help you. But anyway,
you just go to your IDEA distribution directory, plugins subdirectory
and replace the plugin in question with the unzipped attachment.

0

Is PageFragmentCachingFilter class in your Grails module's dependencies
(as a part of Grails library), can you find it by Ctrl+N?

0

Yes it is.

Ctrl-N pulls up the class

0

Could you provide a sample Groovy class that doesn't compile and its
generated Java stub?

0

Thanks Peter. That worked great!  Is this a future build of the Groovy plugin?

0

I am NOT talking about compiling.

I am talking about debugging a Groovy JUnit Test in IDEA.

This issue only happens when I try to run a test

0

That's a special build for you to evaluate and use for some time, until
we include the fix into one of the future builds.

0

To run the test, IDEA needs to compile your project.

Is your file at the same Grails module which has ehcache dependency? Is
the Grails User Library containing this jar declared as having 'Compile'
scope? Could you post your project configuration files (.iml, .ipr,
.idea) here?

0

Has this issue been solved offline? I'm having an identical problem using IntelliJ 9.0.2 and Grails 1.2.2 and can't seem to find a fix for it. Everything worked fine before my upgrade to grails 1.2.2 from 1.1 but now I get this error. Let me know if you need my IntelliJ config files and I'll be happy to post them.

0

Which of the two issues from this topic are you referring two? One (with transient/volatile modifiers) has been resolved in the 9.0.3 EAP, the other (with Grails classes not seen) we can't reproduce so there's no resolution yet. In the case of the not found classes, if you could attach your *.iml files and describe which classes aren't seen and where they are located.

0

I'm having the "Grails classes not seen" issue. The classes that it can't seem to find are referenced in the grails-springcache-1.2 plugin in src/grails/plugin/springcache/web/GrailsFragmentCachingFilter.

I've attached my *.iml files (let me know if you need additional files).



Attachment(s):
intellij9Config.zip
0

I don't see that springcache plugin is installed (or, at least, IDEA doesn't think it's installed). Do you use it directly or is it a transitive plugin dependency?

0

The springcache plugin is listed on line:69 of the digov_public-grailsPlugins.iml that I sent. Is that not where it should be listed?

0

Sorry, my fault. So, do I understand right that the references that can't compile are located in this plugin's source? Are the referenced classes visible in your project (Ctrl+N)? In which jar are they located?

0

No. It's not coming up when I do a search for it using ctrl-N.

I think I've figured out the problem though and I'm not sure how to go about solving it. It appears that IntelliJ doesn't know about the ehcache-web library that the springcache plugin depends on. Springcache is configured to depend on this library and is apparently installing it correctly since the app runs correctly from the command line and from our development server. IntelliJ just isn't finding this class for some reason. If I knew where on grails was putting the file in my .grails/ directory I could at least tell IntelliJ where to look for this class.

Any ideas?

0

Please sign in to leave a comment.