确认你电脑已经安装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的当前版本。
println "hello, world"
for (arg in this.args ) {
println "Argument:" + arg;
}
- D:\groovy>groovy hello.groovy aa bb cc
- hello, world
- Argument:aa
- Argument:bb
- Argument:cc
- 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.
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.