Open Collective
Open Collective
Loading
Groovy 3 support in Eclipse
Published on April 13, 2019 by Paul King

A big thanks to all our contributors. We are on the path to more rapidly progressing the Groovy language and other important projects in the Groovy ecosystem. We are happy to report on one activity that we have helped support and that is initial Groovy 3 support for the Eclipse Plugin with special thanks to Eric Milles.

If you are keen to try this out and don't already have it installed, you should download and install Eclipse in the normal way.

Follow the instructions on the Groovy Eclipse plugin wiki to install the latest version of the plugin or find out more details in the release notes.

Quick start

Once the plugin is installed, you should be able to follow the typical Eclipse workflow to try it out. You could use these steps for instance:

  • Create a new Groovy Project.
  • Select Groovy 3 as your compiler version.
  • Create a Groovy file within the project.
  • Enter some Groovy 3 code, perhaps using lambdas, method references, some of the new operators or try-with-resources support
  • Then select Run As -> Groovy Script to execute the code.

Your screen should resemble that shown below (with whatever code you entered):

Further setup details

A key feature of modern IDEs is to support graceful parser recovery so that a syntax error in one part of your code doesn't cause the IDE to become confused in later valid parts of your code. In this initial version, full error recovery for the new Groovy 3 features isn't complete. So, the Groovy 3 parsing isn't enabled by default. Follow the instructions on the plugin wiki to enable it. There are a few options. This project added a config.groovy file as shown below:

Which is configured under Project Properties:

You might need to restart the IDE and/or reload/refresh your project when enabling this support for the first time or when switching between compiler versions.

Enjoy!