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

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

          注意這個(gè)插件只適用于 eclipse3.1 和 eclipse3.2

          最新版本的站點(diǎn) http://dist.codehaus.org/groovy/distributions/update/

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

          ·選擇 New Remote Site

          · name 中輸入 Groovy

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

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

          ·接受 agreement 并按下 next

          ·如果默認(rèn)的地址正確則按下 Finish

          ·下載完畢后點(diǎn)擊 Install 或 Install All

          創(chuàng)建 Groovy 工程

          ·選擇 File -> New -> Project

          ·選擇 Java Project 并按下 next

          ·在 Project Name 中輸入 GroovyJava

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

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

          到目前為止創(chuàng)建的工程中會(huì)有一個(gè) src 目錄,一個(gè) bin-groovy 目錄和幾個(gè)庫(kù)文件。 bin 目錄被 eclipse 隱藏起來(lái)。你需要將 bin-groovy 目錄作為默認(rèn)輸出目錄連接到 src 目錄使得調(diào)試器能知道源代碼和類文件的關(guān)聯(lián)。

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

          ·? 點(diǎn)擊 Browse 按鈕來(lái)改變 Default Output Folder ,從 bin 到 bin-groovy ,按下 ok 。

          這時(shí) Package Explorer 中出現(xiàn) bin 目錄,雖然不太清楚 groovy 插件為什么要?jiǎng)?chuàng)建 bin-groovy 目錄,也許這里有其他 bin 文件從 groovy 中被分離,或者早期的 eclipse 版本中并不是自動(dòng)創(chuàng)建 bin 目錄。

          在 src 中右鍵創(chuàng)建 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}

          ? }

          }

          運(yùn)行即可

          原文地址:http://www.aygfsteel.com/softwin/archive/2007/04/01/107759.html 作者:伽藍(lán)
          附:Groovy輕松入門--Grails實(shí)戰(zhàn)基礎(chǔ)篇

          posted on 2007-04-02 05:54 山風(fēng)小子 閱讀(6322) 評(píng)論(2)  編輯  收藏 所屬分類: Groovy & Grails
          主站蜘蛛池模板: 龙岩市| 福建省| 保定市| 敖汉旗| 靖远县| 西峡县| 广平县| 安乡县| 临潭县| 肃宁县| 许昌县| 遂宁市| 岗巴县| 广灵县| 阳高县| 绥滨县| 大田县| 穆棱市| 平阴县| 抚州市| 溧阳市| 九龙城区| 元江| 黔西县| 文登市| 柳林县| 城口县| 弋阳县| 阜新| 西华县| 屯留县| 衡阳县| 鄂伦春自治旗| 沅江市| 河间市| 贵港市| 永登县| 保德县| 卢湾区| 宁陵县| 呈贡县|