First they ignore you
          then they ridicule you
          then they fight you
          then you win
              -- Mahatma Gandhi
          Chinese => English     英文 => 中文             
          隨筆-221  評論-1047  文章-0  trackbacks-0

          Groovy 的 Eclipse 插件能夠編輯,編譯以及運行 groovy 腳本和類

          注意這個插件只適用于 eclipse3.1 和 eclipse3.2

          最新版本的站點 http://dist.codehaus.org/groovy/distributions/update/

          · eclipse 下: Help->Software Updates->Find and Install -> Search For New Features

          ·選擇 New Remote Site

          · name 中輸入 Groovy

          · URL 中復制上述的 URL 地址,然后按下 OK

          ·在 Select the Features to Install 選上 Groovy ,按下 next

          ·接受 agreement 并按下 next

          ·如果默認的地址正確則按下 Finish

          ·下載完畢后點擊 Install 或 Install All

          創建 Groovy 工程

          ·選擇 File -> New -> Project

          ·選擇 Java Project 并按下 next

          ·在 Project Name 中輸入 GroovyJava

          ·在 Project Layout 中選擇 Create separate source and output folders 并按下 Finish

          ·在 Package Explorer 尋找新創建的工程,右鍵選擇 Groovy -> Add Groovy Nature

          到目前為止創建的工程中會有一個 src 目錄,一個 bin-groovy 目錄和幾個庫文件。 bin 目錄被 eclipse 隱藏起來。你需要將 bin-groovy 目錄作為默認輸出目錄連接到 src 目錄使得調試器能知道源代碼和類文件的關聯。

          ·? 在 Package Explorer 中,右擊 GroovyJava 工程,選擇 Build Path -> Configure Build Path

          ·? 點擊 Browse 按鈕來改變 Default Output Folder ,從 bin 到 bin-groovy ,按下 ok 。

          這時 Package Explorer 中出現 bin 目錄,雖然不太清楚 groovy 插件為什么要創建 bin-groovy 目錄,也許這里有其他 bin 文件從 groovy 中被分離,或者早期的 eclipse 版本中并不是自動創建 bin 目錄。

          在 src 中右鍵創建 groovy class ,并輸入例子

          class GTest {

          ? static void main(args) {

          ????? def list = [ "Rod" , "Phil" , "James" , "Chris" ]

          ????? def shorts = list. findAll {it. size () < 5 }

          ????? shorts. each { println it}

          ? }

          }

          運行即可

          原文地址:http://www.aygfsteel.com/softwin/archive/2007/04/01/107759.html 作者:伽藍
          附:Groovy輕松入門--Grails實戰基礎篇

          posted on 2007-04-02 05:54 山風小子 閱讀(6329) 評論(2)  編輯  收藏 所屬分類: Groovy & Grails
          主站蜘蛛池模板: 伊金霍洛旗| 灵川县| 孝义市| 锡林浩特市| 仙居县| 镇巴县| 永吉县| 都江堰市| 正蓝旗| 昌宁县| 贵阳市| 兴安县| 青州市| 长沙县| 临沂市| 登封市| 阿拉善左旗| 太仓市| 满洲里市| 民乐县| 墨竹工卡县| 鲁甸县| 松溪县| 西城区| 宣威市| 泗阳县| 峨眉山市| 南昌县| 瓮安县| 浙江省| 隆安县| 新巴尔虎右旗| 陈巴尔虎旗| 布拖县| 汉阴县| 新郑市| 龙口市| 襄城县| 兖州市| 沐川县| 临武县|