Grails 3 has been released with a ton of new features.

GGTS logoIf you’re used to adding a new Grails distribution in Eclipse or Groovy/Grails Tool Suite, you’ve might have experienced that your good old IDE might not support Grails 3 projects right out of the box.

You might be missing:

  • Grails 3 support at all 🙂
  • Gradle support
  • Groovy 2.4 support

Here’s how I think you can fix some of these things.

Grails 3 support

As you regularly do with new Grails distributions is to add it in GGTS under Preferences > Groovy > Grails. But dang!…it doesn’t recognize the grails-3.0.x-directory you just unzipped a minute ago.

GGTS doesn't recognize Grails 3

No worries! We have Gradle now.

Gradle is the new Grails 3 build system, in favor of Gant. If you’ve created e.g. the helloworld-application as used in the Getting Started section of the manual, you see a few files like build.gradle and gradle.properties.

Because of this we don’t need a specialized IDE plugin perse, since existing Gradle tooling can do the trick! So we skip adding a Grails 3 distribution and we look for…

Gradle support

It is possible that GGTS doesn’t know to import a Grails 3 project into your workspace, because of missing Gradle support. You can:

Generate Eclipse/GGTS…

  1. … files with gradlew eclipse.
  2. This will generate .project and .classpath which will allow you to “import it as an existing project” into your workspace

or install Gradle support

  1. Open Eclipse Marketplace, search for “gradle”
  2. Choose e.g. the Gradle IDE pack or just the Gradle Integration plugin
  3. Now you can find and import your project too

In GGTS your Grails 3 project is just a “regular” Gradle project.

Hello world!

The above screenshot is possibly an idealized view – it might as well that you have some red markers! I did.

Grails 3 comes with Groovy 2.4, and if you don’t have the correct version set, you get:

Groovy: compiler mismatch Project level is: 2.4 Workspace level is 2.3
Groovy compiler level expected by the project does not match workspace compiler level.

It’s similar as when you had to install Groovy 2.3 into GGTS 🙂 You can fix the project level to 2.3 but then you get

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

You’ll have to get…

Groovy support

Assuming you don’t already have it, we have to install the Groovy Compiler 2.4 Feature into GGTS.

1. Go to Help > Install New Software and use the update site http://dist.springsource.org/snapshot/GRECLIPSE/e4.4/

2. Select the Groovy 2.4 compiler and Next.

GRECLIPSE update site

3. If there’s a conflict, just press on – it’ll install Groovy 2.4 next to the other versions.

GRECLIPSE update site - just continue!

4. Continue all the way. Finish, restart.

5. Switch the compiler for the workspace. Go to Preferences > Groovy > Compiler and switch to 2.4.3.

Switch to Groovy 2.4.3 compiler

Done.

Happy programming!