Skip to: Site menu | Main content

Groovy 

      Download | Documentation | Developers | Community

An agile dynamic language for the Java Platform

Chinese Home Add comment to Wiki View in Wiki Edit Wiki page Printable Version

Groovy ...

  • 是一个基于Java虚拟机的敏捷动态语言
  • 构建在强大的Java语言之上 并添加了从Python,Ruby和Smalltalk等语言中学到的诸多特征
  • 为Java开发者提供了现代最流行的编程语言特性,而且学习成本很低(几乎为零)。
  • 支持DSL(Domain Specific Languages领域定义语言)和其它简洁的语法,让你的代码变得易于阅读和维护。
  • Goovy拥有处理原生类型,面向对象以及一个Ant DSL,使得创建Shell Scripts变的非常简单。
  • 在开发Web,GUI,数据库或控制台程序时 通过减少框架性代码 大大提高了开发者的效率。
  • 支持单元测试和模拟(对象),可以简化测试
  • 无缝集成 所有已经存在的 Java对象和类库
  • 直接编译成Java字节码,这样可以在任何使用Java的地方 使用Groovy。

Groovy是一个充满创新理念具有创新精神的项目

JAX 是德国十分重要的Java技术会议(Java conference),每一年该组织都会召开会议评选最具创新精神的项目,评选委员会从40个提名项目中选择十个候选项目,许多优秀项目如Matisse GUI builder(NetBeans的一个插件,用于构建GUI程序)、Nuxeo(企业级内容管理解决方案)等都入围候选,最后Groovy赢得了1等奖!这是一个崇高的荣誉,我们感到非常高兴,特别是和许多非常优秀的项目一起竞赛。另外该奖项的上一期胜出者是Spring framework。

还有,由Dierk König创作出版的畅销书------《Groovy in Action》,也会作为奖品赠予Groovy社团,随后JAX将单独设置Groovy主题的会议进行颁奖。这些奖项证明并肯定了Groovy的创新价值,并说明Groovy在Java社团有不小的影响力



Come and meet the Groovy and Grails developers at the Grails eXchange conference, 该会议专注于Groovy的发展、Grails以及JavaEE和Web2.0。



  Groovy就像Java的一个特别版本,除拥有Java企业级应用的性能及能力之外,也透过像闭包、动态类型、灵活简洁的语法、许多Builder工具等特性使其拥有很Cool的生产力。如果你是一个开发者、测试者或者脚本爱好者,你一定会喜欢Groovy。

例子

一个简单的helloworld脚本:

def name='World'; println "Hello $name!"

一个面向对象的复杂些的版本:

class Greet {
  def name
  Greet(who) { name = who[0].toUpperCase() +
                      who[1..-1] }
  def salute() { println "Hello $name!" }
}

g = new Greet('world')  // create object
g.salute()              // Output "Hello World!"

利用现有的Java库:

import org.apache.commons.lang.WordUtils

class Greeter extends Greet {
  Greeter(who) { name = WordUtils.capitalize(who) }
}

new Greeter('world').salute()

在命令行上使用:

groovy -e "println 'Hello ' + args[0]" World
 
























文档 [更多]



快速开始指南

开始安装和使用Groovy的入门指导。



用户指南

 提供使用Groovy语言的语法,程序库和编程指导的相关信息



Cookbook 实例

Illustrates larger examples of using Groovy in the Wild with a focus on applications or tasks rather than just showing off the features, APIs or modules.



Developer Guide

Contains information mainly of interest to the developers involved in creating Groovy and its supporting modules and tools.



Testing Guide

Contains information of relevance to those writing developer tests or systems and acceptance tests.



Advanced Topics

Covers topics which you don't need to worry about initially when using Groovy but may want to dive into to as you strive for Guru status.

模块 [更多]

The following modules and contributions are currently available:

  • COM Scriptingscript Windows ActiveX and COM components with Groovy
  • Gant
  • GFreeMarkeran integration of the FreeMarker template engine for Groovy
  • GMavenGMaven provides integration of the Groovy language into Maven.
  • Google Data Supportmakes using the Google Data APIs easier from within Groovy
  • Grama simple xdoclet-like tool for processing doclet tags or Java 5 annotations
  • GraphicsBuilderGraphicsBuilder is a Groovy builder for Java 2D
  • Grapplet
  • GriffonDekstop Enhancements for Groovy
  • GrooshProvides a shell-like capability for handling external processes.
  • Groovy Jabber-RPCallows you to make XML-RPC calls using the Jabber protocol
  • GroovyJMS
  • GroovyLabProvides a domain specific language (DSL) for math engineering (matlab-like syntax).
  • Groovy Monkeyis a dynamic scripting tool for the Eclipse Platform
  • GroovyRestletGroovy DSL for constructing Restlet application
  • Groovy SOAPcreate a SOAP server and make calls to remote SOAP servers using Groovy
  • GroovySWTa wrapper around SWT, the eclipse Standard Widget Toolkit
  • GroovyWSGroovySOAP replacement that uses CXF and Java5 features
  • GSPmeans GroovyServer Pages, which is similar to JSP (JavaServer Pages)
  • GSQLsupports easier access to databases using Groovy
  • JideBuilderJideBuilder is a Groovy builder for the open source JIDE Common Layer
  • Native Launchera native program for launching groovy scripts
  • Proxy-o-MaticProxy-o-Matic lets you create dynamic proxies fast and in an homogeneous way
  • Windows NSIS-Installera Windows-specific installer for Groovy
  • Windows Servicesframework for Groovy-based WinNT (Windows) Services
  • WingSBuilderWingsBuilder is a Groovy builder for the wingS Framework
  • XMLRPCallows you to create a local XML-RPC server and/or to make calls on remote XML-RPC servers
  • Grailsa Groovy-based web framework inspired by Ruby on Rails
  • GORMthe Grails Object-Relational Mapping persistence framework
  • GroovyPluginA Groovy plugin for JSPWiki
  • OCM GroovyA Object Content Mapping implemented in Groovy leveraging the Java Content Repository (JCR)
  • Tellurium — A test framework built on top of the Selenium test framework implemented in Groovy





Enjoy making your code groovier !!!!

Latest news

If you wish to stay up-to-date with our vibrant community, you can learn more about:

And below, you will find the latest announcements:

Last changed Sep 21, 2008 11:16 by dierk

I'm very happy to announce that the japanese edition of Groovy in Action has just hit the shelves.

Please visit the publisher's page or amazon.jp.

Kazuchika Sekiya and his five friends did an awesome job in not only translating the book "as is" but also updating it to the latest Groovy version (1.5.6), adapting all listings and explanations. Furthermore, they went through all known errata of the original version.

Above all, they did not blindly translate word-by-word but challened the meaning of every sentence, asked for clarification, and came up with improved wordings that avoid any kind of ambiguity.

It should not be left unmentioned that the translators work for Sun Microsystems Japan in their day job but did all that hard work in their spare time.

I'm very thankful for the experience of having seen this translation develop and now seeing the grace of the final result. Let's spread the word about Groovy!

Thank you, guys - domo arigato gozaimasu!

Posted at Sep 21, 2008 by dierk | 0 comments
Last changed Sep 11, 2008 08:32 by Danno Ferrin

After over a year of poking and prodding at the various parts of desktop Java the Groovy swing developers are proud to announce the first release of Griffon, a Grails-like tool for Swing development. While not yet industrial strength we felt it was important to put out a release so people can get a feel for what Griffon is and where it will be going. And since all good computer scientists start counting from zero, 0.0 seemed to be the perfect release number.

What are some of the highlights of Griffon?

  • A Grails like build system for desktop apps, including targets to run the application.
  • A directory structure that rewards MVC separation of code.
  • Use of Groovy programming language features to reinforce MVC separation (builders, @Bindable annotation, metaclass method injection, scripts, etc).
  • A view layer based on Groovy's SwingBuilder, allowing for a declarative layout of GUI code.
  • An infrastructure to allow seamless injection of other widget libraries. JIDE and SwingX are supported out of the box.
  • Automatic packaging and signing for WebStart, Applet, and traditional application deployment.

Why call it Grails-like instead of rails-like? The structure of the directories and some of the design idioms do have a heritage back to Ruby on Rails, but Griffon is more inspired by Grails than it was by Rails. And by "inspired" I mean "taking large chunks of Grails code to bootstrap the codebase" (thanks to the ASL 2.0 this is permissible). Not all Grails features have been brought over yet. Plugins and GORM are two notable standouts that we would like to add in future releases.

To download the current release please visit the wiki page at Download Griffon and follow the links. There is also an installation guide and a quick start tutorial on the wiki as well.

The distribution also comes with three demo apps developed in Griffon: Greet, a Twitter client; GrailsSnoop, a swing wrapper around the Grails docs; and WidgetKitchenSink, a demo app of various widgets supported by Griffon. These applications live in the samples directory and can be run directly by "griffon run-app".

There is clearly much more that can be done, and this is just the beginning. Future releases hope to bring in client side GORM, pack200 support, plugin support, and more GUI libraries. Like most open source projects external contributions and participation are always welcome. For questions and comments there is a griffon-user@groovy.codehaus.org mailing list set up.

Posted at Sep 11, 2008 by Danno Ferrin | 0 comments