Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Groovy ...

  • 是一个基于Java虚拟机的敏捷动态语言
  • 构建在强大的Java语言之上 并添加了像Python,Ruby和Smalltalk等语言中的高效特性
  • 为Java开发者提供了现代最流行的编程语言特性,并且几乎是零学习成本。
  • 支持DSL(Domain Specific Languages领域定义语言)和其它简洁灵活的语法,让你的代码变得易于阅读和维护。
  • makes writing shell and build scripts easy with its powerful processing primitives, OO abilities and an Ant DSL
  • 在开发Web,GUI,数据库或控制台程序时 通过减少框架性代码 大大提高了开发者的生产力。
  • 支持单元测试和模拟,可以让开发者简单的进行测试
  • 无缝集成 所有已经存在的 Java对象和类库
  • 直接编译成Java字节码,可以方便的是用于Java中。

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, featuring dedicated tracks on Groovy, Grails, Java EE and Web 2.0.

"Groovy is like a super version of Java. It can leverage Java's enterprise capabilities but also has cool productivity features like closures, builders and dynamic typing. If you are a developer, tester or script guru, you have to love Groovy."

Samples

A simple hello world script:



A more sophisticated version using Object Orientation:



Leveraging existing Java libraries:



On the command line:



align=center!|align=center!align=center!align=center!|align=center!




Documentation [more|Documentation">more]

align=left,hspace=8,vspace=8! Getting Started Guide
How to install and begin using Groovy as well as introductory tutorials.

align=left,hspace=8,vspace=8! User Guide
Provides information about using the Groovy language including language facilities, libraries and programming guidelines.

align=left,hspace=8,vspace=8! Cookbook Examples
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.

align=left,hspace=8,vspace=8! Developer Guide
Contains information mainly of interest to the developers involved in creating Groovy and its supporting modules and tools.

align=left,hspace=8,vspace=8! Testing Guide
Contains information of relevance to those writing developer tests or systems and acceptance tests.

align=left,hspace=8,vspace=8! 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.

Modules [more|Modules">more]

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
  • 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 Science
  • 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
  • HTTP Builderprovides a convenient builder API for complex HTTP requests
  • JideBuilderJideBuilder is a Groovy builder for the open source JIDE Common Layer
  • MetaBuilderMetaBuilder is a builder that builds builders.
  • 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
  • GroovyFXGroovyFX provides a Groovy binding for JavaFX 2.0.
  • GaelykGaelyk is a lightweight Groovy toolkit for developing and deploying Groovy applications on Google App Engine.
  • GMaven
  • Groovy TransformsProvides additional AST Transformations

  • Grailsa Groovy-based web framework inspired by Ruby on Rails
  • GORMthe Grails Object-Relational Mapping persistence framework
  • Griffona Groovy-based desktop framework inspired by Grails
  • GroovyPluginA Groovy plugin for JSPWiki
  • OCM GroovyA Object Content Mapping implemented in Groovy leveraging the Java Content Repository (JCR)
  • TelluriumA test framework built on top of the Selenium test framework implemented in Groovy
  • GradleThe next generation build system
  • GParsA Groovy concurrency/parallelism library
  • CodeNarcStatic analysis for defects, bad practices, inconsistencies and style issues in Groovy code.
  • GroovyServGroovyServ makes Groovy’s startup time much faster, by pre-invoking Groovy as a server.
  • GBench — The benchmarking module for Groovy
  • GProf — The profiling module for 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:

Hi all,

The Groovy team is very pleased to announce the first beta of the Groovy 2.3 release! 

Groovy 2.3.0-beta-1 is actually already a feature-complete beta, so the release cycle towards the final version will be very short. Furthermore, Grails 2.4 is looking forward to integrating it rapidly as well for its upcoming major release too! So you can expect a general availability version of Groovy in the coming weeks, as we’ll move directly in “release candidate” mode after this beta. But your feedback, as usual, will be very important for trying out this beta in your respective projects, to tell us about any problem you might encounter.

In this email, below, I’ll give you a few pointers regarding the scope of the release, but we’ll be fleshing out a more detailed release notes document in the coming days and weeks with more information.

Warning: this is a lengthy email, but you’ll get to see all the new stuff and improvements the Groovy team and contributors have been working on!

The key highlights of Groovy 2.3 are:

  • Official support for running Groovy on JDK 8

    This is the first version of Groovy to be officially compatible with JDK 8.

    JDK 8 and its interface default methods introduced some incompatibilities with a few methods of the Groovy Development Kit, so we had to adapt to the situation, introducing minor breaking changes for the affected methods and their outcome.

    Note that we’re not planning to backport the changes to older versions of Groovy, so if you want to run Groovy on JDK 8, you’ll have to upgrade to the shiniest version of Groovy!

  • Traits

    A major highlight for Groovy 2.3 is the introduction of the
    concept of traits.

    Traits are reusable components of behavior that you can make your class implement, and are an additional Object-Oriented concept alongside classes and interfaces.

    Groovy traits are stateful (unlike Java 8 interface default methods).

    They allow the composition of behavior without going into the “diamond inheritance” problem allowing you to decide which behavior prevails upon conflict.

    Traits support inheritance, thus a trait can extend another trait or implement an interface.

    Traits are compatible with static type checking and compilation, as well as our usual dynamic behavior. Trait mixed-in methods are actually “real” methods (ie. visible from Java as well) and not just dynamic.

    Traits can also be implemented at runtime with “as” or with “withTraits” if you just want to add behavior of a trait to an object you’re instantiating.

    You can find more information on traits in the exhaustive
    trait documentation.

  • New and updated AST transformations

    • @TailRecursive on methods adds tail recursion to methods which are recursive and call themselves at the last operation of the method body, which helps blowing up the stack with the recursive calls (GROOVY-6570).

    • @Sortable on classes implement comparison methods for you, according to the declaration order of your properties (GROOVY-6649).

    • @Delegate supports includes and excludes attributes so as to let you decide if certain methods should be included or excluded from the delegation (GROOVY-6329).

  • New NIO module for Java 7+

    On JDK 7 and beyond, you can benefit from the same methods as the ones of File, URLs, the various Stream classes, etc, but for the new NIO2 methods, like Path.

    See
    GROOVY-6377 and the pull request for some further hints of the new methods.

  • Various minor performance improvements across the board, for static compilation, the “invoke dynamic” backend, as well as “normal” dynamic Groovy

  • Drastic JSON parsing and serialization performance improvements

    The Rick / Andrey duo spent a fair amount of time optimizing our JSON support, making Groovy 2.3’s JSON support usually
    faster than all the JSON libraries available in the Java ecosystem.

    With
    JsonSlurper, you’ll be able to set different parser types depending on the kind of input you wish to parse, particularly if you know the size of the payload you expect to parse, or whether you want a more tolerant parser which accepts elements like comments which are not normally supported by the JSON specification (GROOVY-6546).

    On the output front, with
    JsonBuilder and StreamingJsonBuilder, which both use JsonOutput for output generation, the serialization has also been tremendously improved (GROOVY-6554).

  • Closure type parameter inference

    We closed a gap which forced you to type your closure parameters to get correct type inference with static type checking or static compilation enabled. In situations like the following, you would have to explicitly give the type of the parameter, but it’s no longer required:

    ['a','b'].each { it.toUpperCase() }

    In the signature of your methods taking closures as arguments, you’ll also be able to annotate the closure parameter with
    @ClosureParams to give additional hints to the type checker to infer the type of the parameters passed to your closure.

    You can also find more about this in Cédric’s blog post on
    closure parameter type inference.

  • New Markup template engine

    Groovy now has an additional template engine, in the form of the Markup template engine, which gives you a very fast template engine, based on the familiar Markup builder approach and notation, but also offering formatting options (indentation, escaping), internationalization, includes, as well as proposing type checked templates and models.

    More details about the new
    Markup template engine in the documentation (GROOVY-6596), as well as in Cédric’s blog, if you want to learn more about the “behind the scenes” stories!

  • Further Groovysh enhancements

Along with some slightly reduced startup time, Groovysh has seen new improvements in its code-completion capabilities:

  • GroovyConsole enhancements

    It is now possible to configure the font used by the console, and also to be able to run a selected snippet of code reusing the imports defined in your script making it easier to just run quick snippets of your script.

  • JUnit 4 GroovyAssert class

    The venerable
    GroovyTestCase (JUnit 3 based approach) has often been used as a base class for your test classes — unless you’ve been using the Spock testing framework, of course. One of the drawback of this class is that your test classes can’t extend your own classes, but must derive from GroovyTestCase to benefit from the additional assertion methods.

    Groovy 2.3 introduces the JUnit 4-friendly
    GroovyAssert, which is a convenient class offering the usual assertion methods of GroovyTestCase, but in the form of static methods that you can static import in your test class.

    We have not included the myriads of assertEquals method from GroovyTestCase as they have become useless with Groovy’s power assert, but it provides the handy shouldFail*() methods (
    GROOVY-6588).

  • ConfigSlurper

    ConfigSlurper just supported a single “environments” non-configurational conditional block, but you couldn’t let you define your own. With Groovy 2.3 you can also create your own ones too, for instance if you wanted to support “flavors” like OS variants (
    GROOVY-6383).

    In addition, the isSet() / hasSet() combo methods (
    GROOVY-4639) have been added so you can double check if a given node of your configuration has been defined. Before, whether the node wasn’t defined or containing null, you couldn’t differentiate either case easily.

  • @BaseScript class improvements

    @BaseScript is a fairly recent addition in Groovy, and it allowed to annotate a variable in your script to instruct the compiler to use a particular base script class for this script. Now we have another notation which is nicer as you can annotate an import or a package (GROOVY-6592) to indicate that base script class:

    @BaseScript(MyScript)
    import groovy.transform.BaseScript


    Additionally, base script classes can now use any abstract method for the script body. This means that you can implement the run() method to implement specific behavior like setup and tear down in tests (
    GROOVY-6585 and GROOVY-6615).

  • New style for the GroovyDoc documentation of Groovy and the GDK methods

    GroovyDoc has been updated with a new fresh and modern skin that will be part of the future visual identity of the Groovy website. Those style updates are also available by default for your own usage of GroovyDoc, making your own documentation nicer on the eye.

    You can have a look at the
    GroovyDoc documentation for Groovy 2.3.0-beta-1.

    We also took the opportunity to apply the same stylesheet to our “DocGenerator” tool which is responsible for the generation of the GDK documentation, showing the methods the Groovy library adds on top of the JDK classes.

    Please also have a look at the new
    restyled GDK documentation.

  • New documentation

    We are still working on the brand
    new documentation for Groovy (in Asciidoc(tor) format), so you can already have a glimpse at what’s already covered or not.

    We’re looking forward for help for fleshing out the various TBD (To Be Done) sections of the documentation, as it’s a gigantic taks to re-document each and every aspect of the language and its libraries! So please shout if you want to
    contribute to the new documentation! All help is warmly welcome!

  • Dependency upgrades

    • Gradle 1.10 for building Groovy

    • ASM 5.0.1 library for generating our bytecode (also needed for our JDK 8 support)

    • JLine 2.11 and JANSI 1.11 library for Groovysh


Groovy wouldn’t be what it is without your support, your bug reports and feature requests, your contributions and pull requests, so big thanks to all those who contributed to this release in a way or another, including the usual suspects of the core team (Jochen, Paul, Cédric and myself), but also André (documentation, GroovyAssert, Groovy Console), Andres (Config slurper, @Sortable with Paul), Tim, Pascal (ConfigSlurper), Johanes (@TailRecursive), Paolo (new NIO module), Thibault (groovysh), Rick and Andrey (for the JSON support), Jim (base script class), Damien (GroovyDoc / GDK styling), Kenneth and several others I’ve forgotten to mention!

And in honor of this first beta release of Groovy 2.3, Cédric even decided to put his birthday on the same day, so happy birthday Cédric, and great work on this release!

We’re looking forward to your feedback running this beta to its pace!

It’s important to make this 2.3 release rock solid!

Download Groovy 2.3-beta-1 and have a look at the JIRA release notes for additional details on issues and bug fixes closed.


Keep on groovy’ing!

 


Groovy Weekly #14

The latest does of fresh news for the Groovy community is out: Groovy Weekly #14



  • No labels