Groovy-Eclipse supports the 2.0, 1.8, and 1.7 compiler for Groovy. However, due to Groovy-Eclipse's tight integration with the compiler, only one version of the compiler can be used in the workspace at one time. Switching compiler levels requires a restart.
By default, Groovy-Eclipse comes installed with a 1.7 and 1.8 compiler. These are the compilers that are installed when you select the Groovy-Eclipse feature from the Groovy update site:
If you would like to install the 2.0.x compiler, then you go to the Eclipse install manager and select the Groovy 2.0 compiler from the extra compilers section of the update site:
Then click Next and follow the instructions to complete the installation. A restart is necessary.
Here are the release update sites for Groovy-Eclipse:
|Eclipse level||Release update site|
After installing Groovy-Eclipse without the extra compilers, the Groovy 1.8 compiler is active by default. And the Groovy 2.0 compiler becomes active after installing the extra compiler.
Specifying compiler level on the command line
As of Groovy-Eclipse 2.5.2, it is possible to specify the compiler level when starting Eclipse from the command line. Just add the following arguments to the command line to start a particular Groovy version when running Eclipse:
It is possible to run multiple instances of Eclipse at the same time targeting different compiler levels as long as they point to different workspaces.
Alternatively, you can add the arguments to the
eclipse.ini file (must be on separate lines and before the
Switching compiler levels in the preference page
You can switch between the 1.7 and 1.8 compilers for your Eclipse workspace in the Preferences -> Groovy -> Compiler page:
Simply click the button and Eclipse will restart automatically. The hyperlink shown on the preference page will navigate you to this wiki page.
Uninstalling the 2.0 compiler
You can uninstall the 2.0 compiler through the update manager. In the lower right corner of the update manager, there is a link that says What is already installed?:
Click the link, select the Groovy 2.0 compiler, and then click Uninstall...:
Then follow the instructions and restart to complete the uninstallation process. Once the 2.0 compiler is uninstalled, you can follow the steps above to reinstall it.
Switching from outside of Eclipse
If you cannot switch compilers from the Groovy Compiler preference page, follow the instructions to perform the switch from outside of Eclipse:
- Shut down Eclipse
- Go to eclipse/configuration/org.eclipse.equinox.simpleconfigurator
- Make a backup copy of bundles.info
- Open bundles.info in a text editor
- Find the line for org.codehaus.groovy_1.8 and delete (thus leaving the 1.7 compiler enabled)
- Restart eclipse
To re-enable the 1.8 compiler, simply reinstate the backed up copy of bundles.info.
Over at AppSatori there is another suggestion on how to do compiler switching. It requires a little more setup than the proposal here, but it allows you to run two workspaces simultaneously using each compiler.
Problems or questions?
There are several possibilities for getting support on your Groovy-Eclipse installation. See here for your support options.