groovy安装
确认你电脑已经安装jdk
groovy官网:http://groovy.codehaus.org/
?
我下载的是压缩版
?
- 将Groovy压缩包解压到指定目录(我的是D:\aaSoftware\groovy-binary-1.8.6\groovy-1.8.6)。注意:Groovy的安装路径不能有空格, 否则会出错。
- 设置环境变量groovy_home,新增环境变量,变量名:groovy_home、变量值:groovy的解压目录。
- 设置path,编辑path,在变量值后面添加%groovy_home%\bin 。
- 测试配置成功.在命令行中输: groovy -v //查看groovy的当前版本。
在命令行输入:D:\groovy>?groovy?hello.groovy?aa?bb?cc ??显示结果:。
- D:\groovy>groovy?hello.groovy?aa?bb?cc??
- hello,?world??
- Argument:aa??
- Argument:bb??
- Argument:cc ?
还可以进入groovyConsole窗口在命令行输入:“groovyConsole”之后打开控制台窗口,键入“println 'hello world'”之后ctrl+R,输出了“hello world”。-----------------------------------------------------groovy-eclipse?plugin安装离线安装:我下载最新的archive-2.6.0.xx-20111212-0900-e37-RELEASE.zip
在线安装:
- Download the snapshot locally
- Do?not?unzip or move into your dropins directory
- Start eclipse
- Help -> Install new software -> Add...
- Select the location of the zip you just downloaded
- Install as you would from the regular update site
Once you have a compatible Eclipse installed, then follow these directions to install Groovy-Eclipse:
- Go to:?Help -> Software Updates.
- Change to the?Available Software?tab.
- Click on?Add Site.
- Paste the update site URL appropriate for your version of Eclipse and click?OK.
- You should see a "Groovy Update Site" entry in the list of update sites. Expand and select the?Groovy-Eclipse Plugin?feature. Optionally, you can choose to include the sources..
- Click?Install?and follow the prompts.
- Restart when asked
- Rejoice!? You installed the Groovy-Eclipse Plugin v2.
For step-by-step installation instructions, see the?Install Groovy-Eclipse Plugin?tutorial.
-----------------------------------------------------创建一个Groovy项目To create a basic Groovy project in Eclipse perform the following steps:
- Open the?Java perspective
- Click on the new Groovy Project icon:?

- The new project wizard for Groovy uses most of the same options as the new project wizard for Java.
- Fill in the appropriate details and create the project.
You should have a?src?folder and several libraries. A?bin?folder is also created, but is hidden.
You can create a Groovy classes or test cases using wizards similar to the Eclipse's Java class and JUnit test case wizards. Use the options on the?File > New?menu or press CTRL-N.
For step-by-step instructions, see the?Create Your First Groovy Project?tutorial.
附:http://pleac.sourceforge.net/pleac_groovy/,内有大量丰富的样例代码,比如说你正计划编写一个工具来获取Web页面并分析,就能够在这里找到这种样例代码