eclipse Groovy:安装后编译器不匹配

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21413003/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 21:30:03  来源:igfitidea点击:

Groovy: compiler mismatch after installation

eclipsegrailsgrails-2.0

提问by Anna.Klee

I am using grails 2.3.4with the eclipse grails plugin(GGTS). However, after installation I created a project and got:

我使用grails 2.3.4eclipse grails plugin(GGTS)。但是,安装后我创建了一个项目并得到:

  Description   Resource    Path    Location    Type
    Groovy: compiler mismatch Project level is: 2.1 Workspace level is 1.8
    Groovy compiler level expected by the project does not match workspace compiler level. 
    Go to Project properties -> Groovy compiler to set the Groovy compiler level for this project   test        test    Groovy compiler mismatch problem

I tried to change the compiler preferences but nothing changes...

我试图更改编译器首选项,但没有任何变化......

enter image description here

在此处输入图片说明

I really appreciate your answer!

我真的很感谢你的回答!

回答by fat_mike

You can also add an extension from the Spring Dashboard and keep using the "same" workspace.

您还可以从 Spring Dashboard 添加扩展并继续使用“相同”工作区。

On the sidebar of Dashboard click on "IDE EXTENSIONS".
Choose the groovy compiler that you need and click install.

在 Dashboard 的侧边栏中,单击“IDE EXTENSIONS”。
选择您需要的 groovy 编译器并单击安装。

After that you can customize each project to compile with a version of your choice.

之后,您可以自定义每个项目以使用您选择的版本进行编译。

Click on a project and then Project>Properties>Groovy Compiler and choose the version from the dropdown menu.

单击一个项目,然后单击 Project>Properties>Groovy Compiler,然后从下拉菜单中选择版本。

For example the latest version of Grails(2.4.0) is "buggy" under GGTS(3.5.1) until you install Groovy 2.3 Compiler extension and change your Projects properties accordingly.

例如,最新版本的 Grails(2.4.0) 在 GGTS(3.5.1) 下是“buggy”,直到您安装 Groovy 2.3 Compiler 扩展并相应地更改您的项目属性。

Grails 2.4 doc whatsNew

Grails 2.4 doc whatsNew

UPDATE for Grails 3.0

Grails 3.0 更新

For Grails 3.0.x you should install and use Groovy 2.4 Compiler

对于 Grails 3.0.x,您应该安装并使用 Groovy 2.4 Compiler

Grails 3.0 doc whatsNew

Grails 3.0 文档新功能

回答by user3614936

I got same error but following option resolved it for me Right Click on Project , Go to Groovy -> Fix Compiler Mismatch Problems. Click on it , it asks for selecting the correct version of compiler select it , clean-build your application and restart it , it should work fine.

我遇到了同样的错误,但以下选项为我解决了它右键单击 Project ,转到 Groovy -> Fix Compiler Mismatch Problems。单击它,它要求选择正确版本的编译器选择它,清理构建您的应用程序并重新启动它,它应该可以正常工作。

回答by Lari Hotari

I'm also seeing this bug. I had to remove other compiler versions from the Eclipse configuration in order to get it working.

我也看到了这个错误。我必须从 Eclipse 配置中删除其他编译器版本才能使其正常工作。

It's possible to pass a command line parameter for choosing the compiler version, but that didn't work for me. I hit this bug after doing that: http://jira.codehaus.org/browse/GRECLIPSE-1642

可以传递命令行参数来选择编译器版本,但这对我不起作用。这样做后我遇到了这个错误:http: //jira.codehaus.org/browse/GRECLIPSE-1642

Basicly I have disabled the other Groovy compiler version by removing the lines from this file: (GGTS home directory)/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info

基本上,我通过从此文件中删除以下行来禁用其他 Groovy 编译器版本:(GGTS 主目录)/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info

I'm using separate Eclipse config directories for different workspaces: https://stackoverflow.com/a/7202782/166062This way I can work on Groovy 2.2 and Groovy 2.1 projects without having 2 complete installations of GGTS.

我正在为不同的工作区使用单独的 Eclipse 配置目录:https: //stackoverflow.com/a/7202782/166062 这样我就可以在 Groovy 2.2 和 Groovy 2.1 项目上工作,而无需安装 2 个完整的 GGTS。