logo logo


Using Grails 2.0 in STS

author: [email protected]

NOTE:8-Sep-2011: The documentation below is for using Grails 2.0 with STS 2.7.1. With STS 2.8.0.M1 (which is available now), the extra setup is not necessary. On 2.8.0.M1, just install the grails tools and groovy tools from the STS dashboard and start using them with Grails 2.0.0.M2. The only update you might want to make is to grab a dev build of Groovy-Eclipse because it includes Groovy 1.8.2 where the default Groovy-Eclipse installable from the STS 2.8.0.M1 dashboard includes Groovy 1.8.1.

By default, STS 2.7.1 enables the installation of Grails 1.3.7 and a standard Groovy-Eclipse distibution (that includes groovy 1.7.10) from the dashboard extensions page. These versions have been thoroughly tested together. However, if you wish to try out Grails 2.0 releases you have to do a few things:

Be aware that STS 2.7.1 will actually work with Grails 1.4.0.M1, and if you follow these instructions you will end up with Grails tools that work with 2.0.0.M1 and not 1.4.0.M1.

If you haven't even got STS downloaded yet, you may want to checkout the setup instructions here.

NOTE: The instructions on this page are a little complicated just because Grails 2.0 has not been released yet (it is only at milestone stage). Once 2.0 is out, all of this will be installable from the dashboard and immediately usable without the need to visit any other update sites.

Installing the latest Groovy-Eclipse

A 'standard' groovy-eclipse distribution does not include the Groovy 1.8 compiler. It is an optional component. Grails 2.0.M1 uses Groovy 1.8 and so you need to install it. There is now a version of the 1.8 compiler on the STS dashboard and you may install that one if you wish, but I'd probably recommend updating to the latest version of the tools as that is the version upon which fixes will be supplied. The following section describes how to install the latest dev build of Groovy-Eclipse.

Depending on whether you are on Eclipse 3.6 or 3.7, choose one of these update sites:

To install from an update site, open the installation dialog via Help>Install New Software - if you previously installed groovy-eclipse you will simply be updating your existing install. Enter the chosen update site from above in the dialog. Once the update site is defined choose the Groovy Compiler 1.8 Feature and the Groovy-Eclipse Feature (as shown):


Then Next and follow the prompts to install, after restarting Groovy 1.8 will be the active compiler. You can switch back to 1.7 if you need to in the future through the preferences page (SpringSourceToolSuite>Preferences>Groovy>Compiler).

Upgrade to the dev snapshot of the grails tools

The grails tools as included in 2.7.1 will work with Grails 1.3.7 and Grails 1.4.0.M1. Due to changes in how Grails processes commands and produces output, a dev build of the grails tools is required for working with Grails 2.0.0.M1 (this version of the Grails tools continues to work with 1.3.7 but will probably not work with 1.4.0.M1).

To update the tools, the process is covered in the "Installing from the nightly snapshot update site" section in the STS Installation instructions. Here are the highlights in case you don't want to dig through that doc:

  1. Download one of these bookmark files (which basically contains a list of update sites) and save it locally:

  2. Import the bookmarks file into STS. Open Preferences > Install/Update > Available Software Sites:

    Now click Import... and point it at the bookmarks file.

  3. Once defined, go back to Help > Install New Software, select the TOOLS/nightly site, and select the Grails tools, as shown here:

    Click Next and click through to install the tools.

    2. Tell STS about your Grails 2.0

    Either you already have a Grails 2.0 somewhere on your disk, or you need to grab one (from here: http://grails.org/Download) and unzip it.

    Then in STS, open the Grails preferences (SpringSourceToolSuite>Preferences>Groovy>Grails) and Add then Browse:


    Navigate to your local grails 2.0 install and click OK and that's it! You are ready to work with your 2.0 projects.

    Due to our limited testing of Grails 2.0 with STS you may encounter problems, please raise jiras for any issues you encounter. Here is the STS Jira: https://issuetracker.springsource.com/browse/STS.

    Back to the index