-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Groovy-Eclipse appears to interfere too much with Gradle projects #1053
Comments
When you open a gradle script, the default is to use the Groovy editor. If you don't want to have Groovy-Eclipse try to parse and interpret the gradle script, you can right-click on the file and choose Open With > Gradle Editor. I think there is a way to make this the default for all .gradle files. Also, if your project has the Groovy nature added to it, the Groovy builder will run along with the Java builder. Although, it likely won't have any sources to process if you only have .gradle scripts and .java sources. |
Where is your |
I just opened logback.groovy (path {project}/src/main/resources/logback.groovy) using a plain text editor. Unfortunately the nasty error mark is still there (even after a Gradle Refresh and restart of Eclipse). The mark persists both in the editor and next to the file in Project Explorer. As I say, my app and testing code is written entirely in groovy... all these files end ".groovy", not ".gradle". I only have two .gradle files: build.gradle and settings.gradle. Glad to see there's a bug about this - looks like you created it. Is it a big job to tackle it? |
I'm not sure I track the exact nature of the problem. If your project targets Groovy 2.5 then the Groovy Compiler should be set to match. I understand there is a long-running issue with compiler switching; there are several workarounds for that including removing Groovy Compiler 3.0. That said, I did just check in a fix for "Groovy:Unexpected problem with AST transform: null" so at least the error can properly be displayed. And no, Spock transform should not be applied to main sources. I have not had time to get around to splitting up the project class loaders for main and test dependencies. |
[SOLUTION / WORKAROUND] More importantly, switching that to 2.5.9... means that the AST Transform error has... GONE! For the sake of completeness, could you just say how Groovy compiler 3.0 can be removed? I couldn't find a way of doing that. |
Just for completeness, there are at least 3 known workarounds for the "Invalid Registry Object" errors (part rendering shows red Xs) #317, et. al (links below):
Also, I have submitted a fix patch to eclipse platform. It is in code review and may make Eclipse 4.16: https://git.eclipse.org/r/155098 And here are bugs for this issue:
|
With regard to your original post, can you send a screenshot of your project with logback.groovy, build.gradle and .project open so I can understand what "interfere" refers to? It sounds like you don't have a pure gradle project, but instead have Java and Groovy natures and so there is some building/compilation going on. |
Sorry, me again! I promise I'll give it a rest after this.
NB I can also imagine that anything to do with Groovy must be very high-level technical stuff... and when you throw Java 11 in the mix this must make things even worse.
My latest problem is described here on SO.
Essentially, I am finding that by including the following (essential!) line in build.gradle, a completely inexplicable (to me) "AST transform" error is cropping up:
testImplementation 'org.spockframework:spock-core:1.2-groovy-2.5'
As I say at the end, really the "workspace level" of Groovy should not get involved with Gradle projects at all, since they use configured versions of Groovy, both to execute build.gradle and the DSL, and also the user code (if written in Groovy with the Groovy plugin in build.gradle).
And yet, of course, something must be involved in analysing the Groovy code in my project: otherwise I wouldn't have detection of (real) errors, code completion, syntax colouring, etc.: the component which does this is your module Groovy-Eclipse (for which I thank you).
Incidentally, these (spurious) AST transform errors do not stop Gradle projects from executing their various tasks, either in Eclipse or at the CLI. The Java setup in Eclipse lets you choose to ignore errors which you know are spurious. There doesn't seem to be any way of doing that with Groovy-Eclipse.
I've spent about 2 hours recreating my projects today (and learning stuff). Tomorrow I may start from scratch again, but setting the Groovy-Eclipse "workspace level" to 2.5.9 right at the start: as I say in the SO question, and as I mentioned yesterday, I find that the whole of Eclipse goes awry when I try to change that currently.
The text was updated successfully, but these errors were encountered: