在最近的项目中, 由于在activiti中有使用groovy,我想系统地学习下。 要想学好一门语言, 第一步,应该是先搭建环境,然后写个helloworld, 写helloworld是我们都喜欢做的, 能写helloworld,说明已经可以开始基本的学习了。 那废话少说,我们首先搭建环境吧。
搭建groovy环境
我使用的eclipse 环境是Eclipse Java EE IDE for Web Developers., Version: Kepler Service Release 2,
启动eclipse,点击help -> Install New Software... 这个可以参考一般的插件安装文档安装即可 。 我使用的是Groovy插件的地址:http://dist.springsource.org/release/GRECLIPSE/e4.3/
HelloWorld
在eclipse新建Groovy Project项目,在在项目中,新建HelloWorld.groovy文件
package com.test
class HelloWorld {
static main(args) {
def name = 'Guillaume' // a plain string
def greeting = "Hello ${name}"
//assert greeting.toString() == 'Hello Guillaume'
println greeting
println greeting
}
}
Run as Groovy Script运行。