开发者

Can I write Eclipse plugins using Groovy?

Groovy开发者_如何学JAVA seems to fix a lot of the things I dislike about Java, and I was wondering if it would be possible to actually write an Eclipse plugin in Groovy instead of Java.

Does anyone know if this is possible, and if so how to go about it?


I've just found a blog entry which says it's not officially supported but is actually possible.

Not yet tested to see if it works, but it seems promising:
Writing Eclipse plugins with Groovy, by Jörn Dinkla


@Peter, I do not think that the blog post you linked to is complete or if it will really work. It is pointing to the old version of Groovy-Eclipse, which is no longer supported and is out of date.

Yes. It is possible to create your own plugins in Groovy.

  1. First, install the Groovy-Eclipse plugin from here: http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/
  2. Then you can create a new plugin project and add the Groovy Nature.
  3. Remove the Groovy Libraries classpath container
  4. Instead, add the org.codehause.groovy as a required bundle
  5. Create your Groovy code as normal
  6. Now, the tricky part is exporting the plugin using PDE. See this blog post for how to do that: http://contraptionsforprogramming.blogspot.com/2010/08/groovy-pde-redux.html One important thing to note is that you will need at least one Java file in your project for PDE to compile anything, It can be a dummy, empty file (this is a bug that has not yet been fixed).
  7. Rejoice!

As an example, here is the codenarc Eclipse plugin that was written completely in Groovy: http://sourceforge.net/projects/codenarceclipse/


You can also use JRuby, or Javascript ...

JAM Circle is a great example showing how to make great use of a scripting language in an Eclipse plugin, by allowing the end user to write his own actions and load them at runtime.


There's a proxy-like plugin that allows you to implement the plugin virtually in any language that supports JSR223 (javax.scripting)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜