How to use groovy inside a Eclipse RCP project?

谁说我不能喝 提交于 2019-12-07 08:18:49

问题


I have a Eclipse RCP project, and I want to use Groovy inside it. what I try to do is :
1) add "Groovy Nature"
2) create Groovy files under the "src" folder
3) call the groovy class from the "View"'s createPartControl() method.

But I got the “java.lang.ClassNotFoundException: fly.island.jface.Test”, and the "fly.island.jface.Test" is a groovy class.

What should I do to use groovy inside the Eclipse RCP project?


回答1:


Use the latest version of Groovy-Eclipse 2.1.0 (or one of the dev builds). Update site is here:

http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/

Additionally, there are some steps you need to do to compile the groovy plugins when you the PDE build. I'd recommend reading:

http://contraptionsforprogramming.blogspot.com/2010/08/groovy-pde-redux.html

Essentially, you need to include the org.codehaus.groovy bundle in your rcp app, and then you need to make some changes to the build.properties file of your Groovy plugins (explained in detail on the blog post).




回答2:


Are you using the latest Version of eclipse (3.6) and the groovy plugin? I recall occasionally having problems with the Java and Groovy compilers not finding each other's classes (in the first version of the plugin, it took a lot of fiddling and luck to get it to work at all). The most recent version seems to be pretty good in that regard, though I've been using it only for a few days myself.



来源:https://stackoverflow.com/questions/4295932/how-to-use-groovy-inside-a-eclipse-rcp-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!