Grails compiler mismatch - eclipse

I am getting a message for when I start a new Grails project that project level is 2.1 and workspace level is 2.0.
When I go to preferences>Groovy>compiler it say the current version that I have is 2.0.7.
I have also tried right clicking on the project and then choosing Groovy>fix compiler mismatch problems.
I am using eclipse Kepler j2ee on a mac and using grails 2.3.3. How can I fix the program?

I think you should change your groovy compiler version to 2.1.5
Currently i use Grails.2.3.0 under preference->grails
and my groovy has been selected like this one You are currently using Groovy Compiler 2.1.5
There is a Switch to Selection for Groovy Compilers --but i suggest
Makes usre your groovy package has been insatlled or package is not corrupted and correct.
Change or install groovy compiler 2.1.5 that works fine with Grails 2.3.0 or Grails 2.3.3
and Make Refresh Dependency To your Project...

Right click on project. Go to Properties.

Related

Grails 3 eclipse support

i want to know if there any Eclipse IDE versions support Grails 3.3.2 , as i'm currently using Luna and tried to use this Grails version but i faced the below error, also tried Grails tool suite and got the same error. I tried it using intellij and worked fine without any exceptions
------System.err:-----------
Error: Could not find or load main class org.codehaus.groovy.grails.cli.support.GrailsStarter
many are saying that eclipse doesn't supports Grails 3 is that right ? and how to work with Grails 3 on eclipse ?
There is no such thing as Grails from the POV of IDE anymore. There is a Gradle project with a bunch of dependencies. That means that things like GGTS are not needed (and therefore not supported).
For my Grails projects I use Eclipse Oxygen with Buildship (gradle support) and Groovy feature plugins.
The only 2 things that I'm missing in my current setup is no autocomplete for dynamic finders and GSP. The rest works just fine.

Grails Build Test Data plugin having AST issues with Eclipse

I didn't have this problem before but now it just appeared and I don't know how to fix it. I tried it on many different Eclipse versions but I get the same problem.
Groovy:Unable to run AST transform
grails.buildtestdata.mixin.BuildTransformation: missing class
grails/buildtestdata/mixin/BuildTestDataUnitTestMixin: are you
attempting to use groovy classes in an AST transform in the same
project in which it is defined?
http://groovy.codehaus.org/Eclipse+Plugin+2.0.0+FAQ#EclipsePlugin2.0.0FAQ-Q.DoesitsupportcustomASTtransformations%3F
Could appear after a grails clean.
Run Grails Tools -> Refresh Dependencies and after that Project -> Clean....
Make sure that your groovy version is correct for your version of Grails. I had the same issue while compiling a file with groovy 2.3 and then when the compiler got upgraded to 2.4 the #Build annotation failed, the AST transform did not work properly.

GGTS 3.6 Groovy:Internal groovy compiler error

I have a grails project, recently nothing compiles.
in eclipse on the Problems tab I see 100 out of 300 problems, most of them are Groovy:Internal groovy compiler error. every class has a red X on it, if I add an empty line in the file and save it the error would go away but not for long.
I had tried Build / Clean (both eclipse's and grails') / Refresh Dependencies / Compile in any possible combination. The run-app command works from eclipse with no issues. but eclipse is going crazy because I have so many errors. The only way I could make the errors go away is to disable eclipse's Build Automatically option and clean (without allowing it to build after)
Does anyone has an Idea ?
Current GGTS settings
Windows -> Preferences -> Java -> Installed JREs == jdk1.8.0_11
Windows -> Preferences -> Groovy -> Compiler == 2.3.3
Windows -> Preferences -> Groovy -> Grails == Grails 2.4.2
Help -> About Groovy/Grails Tool Suite == Version: 3.6.0.RELEASE
You can change your compiler level in (your workspace)/.settings/org.eclipse.jdt.groovy.core.prefs
We had this same problem with a project we had upgraded, switched from
groovy.compiler.level=23
to
groovy.compiler.level=21
and all the errors went away.
Seems like you're experiencing some sort of mismatch between versions of Java, Groovy Compiler and Grails. Perhaps your Groovy compiler is the latest 2.3.x from the update site but Grails version is lower than latest. Try starting GGTS 3.6 with Java 8 VM also set it as currently installed JRE in the preferences, set Groovy compiler to 2.3.3 and use Grails 2.4.1 or later.
Groovy below 2.3 and Grails below 2.4 don't support Java 8. I'd play around with the versions of Java, Groovy compiler in Eclipse preferences and Grails version to fix this problem.

GGTS repetitive method name/signature error in controllers

I am using latest GGTS v3.4 based on eclipse 4.3.1 64bit version for development app on Grails 2.3.2. Every single controller that is in my classpath has an error in it. There are two identical errors per every controller class.
Groovy:Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'package.SomeController'.
SomeController.groovy /appname/grails-app/controllers/package line 1
Java Problem
Everything just work, but my Problems tab is getting quite messy.
This seems to be a problem when you run GGTS with JDK8. Switching to JDK7 fixes the problem until the problem is fixed.
See issue comments of STS-3696
I usually have this issue in GGTS whenever I start a project. Look at your Project properties and check to make sure the correct version of Groovy is selected for the workspace.
I'll find the Groovy version is set to 1.8 when I'm using 2.0.
Upgrading to Grails 2.4.4 fixed the issue for me.
My conf of GGTS is:
Version: 3.6.3.RELEASE
Platform: Eclipse Kepler SR2 (4.3.2)
JDK 1.7
It could be one of several reasons.
Grails Version in Window -> Preference -> Groovy -> Grails.
Groovy Version in Window -> Preference -> Groovy -> Compiler.
Java Version is not set correctly. It's your PATH instead of under Window -> Preference -> Java -> Installed JREs. If it doesn't match the Groovy/Grails for your workspace/project, there would be error.
For example, I run into this problem when I am using Grails 2.3.1, Groovy 2.1.8. My Java version is 1.8, which is incompatible with Groovy 2.1.8. I changed it to 1.7, restarted GGTS, the problems are gone.

Grails 2.2.0 Support in Eclipse

I am trying to create a grails 2.2.0 project using eclipse-jee-juno. It gives me an error
Groovy compiler level expected by the project does not match workspace compiler level.
Project compiler level is: 1.8.X
Workspace compiler level is 1.7.X
Go to Project properties -> Groovy compiler to set the Groovy compiler level for this project.
Background: I have installed grails 2.2.0 and I am able to create and run a sample project/controller by using the command line (not eclipse)
Grails 2.x need groovy 1.8+ to work. In eclipse, right click your project, select 'properties' from menu and go to Groovy compiler, select groovy version 1.8.xxxx. Or you can go to 'preference' menu and change the global setting for groovy compiler version.
Here are the steps that enabled me to run the application on grails 2.2.0.
Install JDK 7
Install Grails 2.2.0
Install eclipse-jee-juno or GGTS
Download grails-2.2.0.RC4
Under GRAILS_HOME\lib, Create a directory com.springsource.springloaded with a subdirectory springloaded-core
Copied contents of RC4\lib\org.springsource.springloaded into com.springsource.springloaded
Restart GGTS or Eclipse. Your GRAILS app should be up and running!