支持 Groovy 2.0的 Groovy-Eclipse 2.7.0 發布,

jopen 12年前發布 | 15K 次閱讀 Groovy

Groovy Eclipse Plugin(插件)是script語言Groovy的開發輔助工具,它提供編輯,編譯,以及執行groovy腳本的功能。

Groovy-Eclipse 2.7.0. 這是首個包含 Groovy 2.0 正式版,同時支持 Eclipse 4.2 的版本。
詳見:
The Groovy-Eclipse team is proud to announce the release of Groovy-Eclipse 2.7.0. This is the first release that includes Groovy 2.0 final and that is available on Eclipse 4.2 (Juno).  Now that Eclipse 4.2 is released, we will be dropping our Eclipse 3.6 support.

You can use the following update sites to install this release:

Groovy-Eclipse update site for Eclipse 4.2 and 3.7

For Eclipse 4.2 (Juno):
http://dist.springsource.org/release/GRECLIPSE/e4.2/

For Eclipse 3.7 (Indigo):
http://dist.springsource.org/release/GRECLIPSE/e3.7/

 

The Groovy 2.0 compiler is not installed by default.  If you want to install it, you can do so from the Extra Compilers category in the update site.

And a zipped version of the update site is available at:

Zipped Groovy-Eclipse update site for Eclipse 4.2 and 3.7

For Eclipse 4.2 (Juno):
http://dist.springsource.org/release/GRECLIPSE/e4.2/archive-2.7.0.xx-20120703-1400-e42-RELEASE.zip

For Eclipse 3.7 (Indigo):
http://dist.springsource.org/release/GRECLIPSE/e3.7/archive-2.7.0.xx-20120703-1400-e37-RELEASE.zip

You can install from the zip by pointing your Eclipse update manager to the downloaded zip file and following the installation instructions.  Do not unzip into your Eclipse dropins folder.

Groovy 2.0

Groovy 2.0 is now available in Groovy-Eclipse as an optional add-on.  We have not yet made the compiler default because we make our default compiler compatible with the default compiler of the latest release of Grails.  At the time of this release, Grails is at version 2.0.4, which uses Groovy 1.8 as its compiler.  When Grails moves to being based on Groovy 2.x, Groovy-Eclipse will move its default compiler as well.

To install Groovy 2.0, go to Help --> Install new Software.  In the work with tab, choose the Groovy-Eclipse update site and select the Extra Compilers category:


Read Compiler Switching within Groovy-Eclipse for more information on how to install Groovy 2.0 and how to switch compiler levels.

Maven integration with groovy-eclipse-compiler

The groovy-eclipse-compiler plugin for maven has just released the 2.7.0-01 version and now uses Groovy 2.0 to compile against by default.  You can specify other Groovy compiler levels if required.  See Groovy-Eclipse compiler plugin for Maven for more information.

@TypeChecked and @CompileStatic Support

With the 2.0 compiler enabled, you can use the @TypeChecked and @CompileStatic annotations and Groovy-Eclipse compiles with them appropriately.  Here is an example from the What's new in Groovy 2.0 article on InfoQ:

TypeChecked

CompileStatic

Also, reconciling (i.e., eager parsing as you type) handles these annotations properly.  So, you get proper affordance when changing int object = new Date() to Date object = new Date():

Assign statement to new local variable quickfix

The Groovy-Eclipse editor now provides a new quickfix for assigning a statement to a local variable.  To access the quickfixes, press CTRL/CMD+1.  Choose Assign statement to new local variable:

And the results look something like this:

Convert variable to field

Groovy-Eclipse now provides a refactoring to convert local variables to fields.  To access the refactoring, select a local variable:

In the context menu, choose Refactoring --> Convert Local Variable to Field...

A wizard pops up where you can tweak your options and preview the results:

Note that not all options are implemented yet.  Unimplemented pieces of the refactoring wizard are grey.  After pressing OK, you will see something like this:

Doc hovers with @link and @see

Doc hovers now respect the @link and @see JavaDoc tags, so you can add them to your DSLDs and users will be able to follow proper links to other parts of the source code:

Source code to github

Groovy-Eclipse is now on GitHub.  Forking and pull requests are appreciated!

The old SVN repository is no longer valid.

Compatibility

Groovy-Eclipse 2.7.0 includes Groovy 1.8.6 by default. Groovy 1.7.10 can be enabled optionally, and Groovy 2.0.0 can be installed through the extra compilers section on the update site.

This version of Groovy-Eclipse is recommended to be installed on STS 2.9.2, STS 3.0.0.M3, Eclipse 3.7.2, or Eclipse 4.2.  There is also a 4.2-based Groovy-Eclipse now available.  See above for the update site.

Bug fixes

See the details on our issue tracker.

What's next?

We are planning a 2.8.0 release in October. You can take a look at all issues we are planning to fix for this release.

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!