Problems with Java-Groovy joint compilation 关注
Since IDEA switched to groovyc's stub generation, I get lots of errors of the kind "groovyc couldn't generate stub for...". None of my bigger mixed code projects compiles successfully. In order to look into these issues, I need to know what exactly the problem is. How can I get IDEA to provide more output? Cannot find anything in the log file.
This message means that groovyc hasn't reported anything, but there's no
.java file where it should be. I know of one source of these problems:
when groovy class extends something that groovyc is not aware of (either
it's a Java class or a .class file that's missing from classpath).
I suppose there is something wrong with the way IDEA invokes groovyc. Stub compilation fails even for trivial cases, which I can't reproduce with plain groovyc. Also, a full rebuild gives me warnings like the following:
Warning:Groovyc stub generation failed: Groovyc error: X class not found while resolving class Y; try compiling X explicitly
Due to these issues, I'm still stuck with #10666. What can I do to help resolve these issues?
As usual, a small problematic project will certainly help. But I have
one guess. Is it a multi-module project with inter-module groovy->java
Yes, it's a Maven-based project with 58 modules and inter-module Java->Groovy and Groovy->Java dependencies. (G)Maven build works fine.
Then it's a known problem and I hope it will be fixed in Maia
I hope too, because this is a blocker for me. I can't run any unit tests in the project, because IDEA always reports compile errors. Is there an issue that tracks this problem?
Not yet, please be sure to create it.
In fact, there is a workaround, though not very pleasant. You can
compile modules by one in the order of their dependencies, at least
those which cause compilation problems.
If it's a known problem then I find it kind of strange that it doesn't already have an issue in YouTrack? Is it created now?
I have the same problem, stuck on 10666.
Tried 10762 and now IU-90.94, but a "Rebuild project" ends in:
Warning:(4, 1) Groovyc couldn't generate stub for XXX
Error:(20, 9) cannot find symbol class YYY
My project has only dependencies to Java from Groovy, no dependencies to Groovy from Java. It's only one war module that builds fine with 10666 and with maven.
I tried cleaning out ~/Library/Caches/IntelliJIdea90, but it didn't help.
The Error is when compiling a subclass of GroovyTestCase, and the class it tries to find is the class my test is testing. It seems like groovyc tries to do things in the wrong order.
I've created http://youtrack.jetbrains.net/issue/IDEA-25193
Thanks Peter N.
Peter G: Do you think I am facing the same known problem, or should I create a separate issue in YouTrack?
If it's an inter-module dependency, then yes, it's the same problem. If
it's inside one module, then a separate one. In the latter case, a
sample project will be appreciated for us to reproduce it.
It is inside one module, so I created a new issue:
Attached a sample project where I removed as much as I could from my original project (and did some renaming of classes/packages)
I've had the same problem, but using the stub generation switch made compilation work again.
Did the trick for me as well