I am using NetBeans 7.1, which comes with Groovy 1.6 support. I have to do a Grails project, but with Groovy 1.8 support. So I downloaded Groovy 1.8 installer, installed it and added the Library in Netbeans -> Tools -> Libraries (and removed Groovy 1.6 library).
Now whenever I use some stuff added in Groovy 1.8 within my Grils project, it still underlines it and throws "cannot resolve" error... I was googling it for last 2 hours and everything I find seems I have already done... it starts to give me a headache... Any suggestions on how to solve it?
NetBeans support from Groovy has -- until recently -- stagnated.
The Groovy support (as you say) is for Groovy 1.6.X, and the Grails support is similarly old.
There has very recently been some activity in trying to improve this, but at the current time you are probably better using Eclipse, STS (both free) or IDEA (paid) if you want proper IDE support for up to date Grails development.
Related
I create a new Grails project from NetBeans but when I complete the project complition wizard, nothing to show in my NetBeans project window. My details configuration is:
NetBeans 8.0.2, JDK 8 64bit, Grails 3.0.1
I check my environment veriable setting for Java & Grails also. Everything seems ok, and one important thing is in command line when I type grails -version, it shows the version name and so on. I uninstall NetBeans, JDK, & Grails several times but same problem, I also try it for JDK 1.7 32 bit, no result. I'm used to with NetBeans, so I don't try to other IDE.
Maybe look where the project is defined on disk and open it into NetBeans.
I dont know how this case was solved, but to me it looks like the problem is still valid:
The New Project wizard (Groovy -> Grails Application) calls "grails create-app" but does not generate the nbproject directory.
My environment is:
NetBeans: 8.0.2; Grails Version: 3.0.4; Groovy Version: 2.4.4; JVM Version: 1.7.0_79
Netbeans 8.0.* does not have support for Grails 3.* projects. It can create project but cannot recognize and open the project since the project structure has been dramatically changed from Grails 2.* to 3.*. There was a task created to resolve this problem. Now it reads VERIFIED FIXED for version 8.1. So please upgrade to Netbeans 8.1.* in order to be able to handle Grails 3.* projects in Netbeans.
I was running Grails 2.2.0 in NetBeans and it was working fine. I tried to upgrade the project to Grails 3.0 but after creating the project NetBeans is not able to open the project.
Does anyone know which plugins to install in NetBeans (if available) to make Grails 3.0 work?
Just wanted to let you know that I've added initial support for grails 3 in NetBeans.
https://netbeans.org/bugzilla/show_bug.cgi?id=254405
At the moment you can get these with the latest NetBeans nightly: http://bits.netbeans.org/download/trunk/nightly/latest/
This will allow NetBeans to recognise/create projects, and the create controller/domain/etc actions working.
One important thing still missing is adding support for the gradle build files (no syntax highlighting or helpers for the gradle files), but in the meantime you may try it and report problems/improvements.
I need to setup a Windows working environment for Grails. I'd like to use GGTS as an IDE but got several errors compiling a sample project. Currently I'm using jdk1.8.0_40 and Grails 2.5.0. which results in this error (but in the end the project is working):
Groovy:Unexpected problem with AST transform: The Spock compiler
plugin cannot execute because Spock 1.0.0-groovy-2.4 is not compatible
with Groovy 2.3.10. For more information, see http://versioninfo.spockframework.org
On top of that there are two Java Exception Breakpoints which are listed as "unknown". Only info regarding version support I could find is:
Java SDK 1.5+ for Grails 1.2 or greater
GGTS itself seems not to run with the latest grails (3.0.1) since I simply cannot add it (directory appears not to be a grails installation).
Should I use Java 7 instead?
This issue is not related to JDK 1.8 or 1.7, but its is related to the GGTS IDE 3.6.4 Groovy Compiler version. As the error clarifies that Spock 1.0.0 version needs Groovy 2.4 compiler.
GGTS 3.6.4.RELEASE-e4.4.2 IDE comes with Groovy 2.3.10 compiler by Default.
Install Groovy Compiler 2.4 Feature and "switch to 2.4" will resolve this issue.
Refer: http://docs.codehaus.org/display/GROOVY/Compiler+Switching+within+Groovy-Eclipse
If you cannot switch compilers from the IDE Groovy Compiler preference page, follow the instructions to perform the switch from outside of Eclipse:
(Grails 2.5.0 uses Spock 1.0.0 (and internally Groovy 2.4.3 and this is why your project is compiling & working fine as the Grails runtime environment is taking over)
As an additional experience report to the answer above, thus providing another solution variant: I had to use the http://dist.springsource.org/snapshot/GRECLIPSE/e4.4 update site (as opposed to the release version mentioned in the link above) to make the 2.4 compiler feature available in the update manager.
After installation, the compiler errors are gone.
I noticed that project-specific groovy compiler is set in the Groovy Compiler preference page in new grails projects. By selecting "I don't care" for "Groovy compiler" it will default to the workspace groovy compiler which is usually correct (for me it's version 2.4). This worked for me but experience may vary.
I have been developing Grails apps for the past five years or so, and I have yet to find a simple consistent procedure for upgrading a project between Grails versions. Typically, I wind up starting the project from scratch, painstakingly copying code from the old project into a new project, bit by bit. Tweaking along the way to get the tests to pass.
There just seems to be too many balls to juggle, from Grails versions, to groovy versions, to STS/GGTS versions. They all seem to be backwardly incompatible.
I actually work with Grails for a few years too and never had to that this way.
What I do is:
Install the new version of Grails. I use GVM for that and I highly recommend it, but it depends on your platform of choice.
Read release notes for this version and apply them. It's very important step. It often includes some Grails "built-in" plugins upgrades and so on.
Bump up the version number using grails set-version.
Update IDE settings. I use IntelliJ and it runs smoothly most of the time.
Do grails clean/grails clean-all. Remove target.
Run all tests.
Do some "smoke tests" of the application. Test the most important happy paths.
I'm afraid you might already be doing it right, but if you don't own a copy of "Programming Grails" by Burt Beckwith I suggest you buy it. There's a chapter on "Upgrading Applications and Plugins" that might help you tune your approach.
You can upgrade grails version with 5 steps
Project -> Clean
application.properties -> Change app.grails.version = (New version)
Your project -> Properties -> Grails -> Change grails installation to new grails version.
Your project -> Grails tools -> Refresh Dependencies
Run your project
I think this may be help you
If I use GGTS I do the following:
Just in case install latest Groovy compiler (2.3.x) from the STS/GGTS update site (pick Groovy Eclipse). Then select the select.
Go to Preferences Groovy -> Grails and add newer version Grails runtime. Browse to it and then once added check-mark it.
Right-click on the Grails project you'd like to upgrade. Context menu pops up. Click on Grails Tools -> Grails Command Wizard...
Select the "upgrade" command from the list and click Finish. Follow the prompts in the Console view to upgrade the project.
Now set the appropriate for the version of Grails Groovy Compiler version via the preferences Groovy -> Compiler and restart Eclipse
Fix the compiler version for the Grails project if necessary after the restart.
More often when I install a plugin, doesn't recognize it.
For example using Joda Time, I have a variable LocalDateTime date (i'm importing joda library) and eclipse says unable to resolve class LocalDateTime, though the application works.
Or I have installed the grails icepush plugin but after the installation taglib files were missing.
It's a SpringSource problem?
You should upgrade to SpringSource Tool Suite (STS) which is Eclipse bundled with a suite of plugins. It has great support for Groovy and Grails. 2.5.0 was recently released and it has a plugin wizard for installing, updating, and uninstalling plugins, although it supports plugins installed from the commandline too. I find I sometimes need to manually refresh it but that's simple - just right-click on the project and select Grails Tools | Refresh Dependencies.
After installing you'll need to add support for Groovy and Grails - that's available from the Dashboard.
Download from http://www.springsource.com/developer/sts
You are not doing anything wrong, chances are the eclipse toolset is still behind the competition. As mentioned by #Burt, you can get the STS from SpringSource directly or you can get IntelliJ IDEA which also has a very good clean interface to Grails applications. The latest 9.0.3 works very well with large, complex Grails applications, and seems to have a very advanced intellisense (autocomplete) capabilities.