
Groovy 1.0
has been released and is available for
download from the project homepage.
"Groovy is a dynamic language for the JVM that integrates seamlessly with the Java platform. It offers a Java-like syntax, with language features inspired by Smalltalk, Python or Ruby, and lets your reuse all your Java libraries and protect the investment you made in Java skills, tools or application servers. Groovy can be used for various purposes, from ad-hoc shell scripting leveraging Java APIs, to full-blown web applications built on Spring and Hibernate through the Grails web framework.
It can also be integrated very easily in your applications to externalize business logic, create Domain-Specific Languages, or to provide templating capabilities, and much more."
Member since:
2006-03-20
Groovy is awesome. I used it when I developed a CLI tool in java last week (had to be java because it had to hook into some existing .jar libs). My tool had to include lots of multiline strings with variable substitution in them. Try doing this in pure java -- it's hell.
I usually do stuff like this in ruby, perl, or python where I can use a here-document, $qq{} or triplequotes. In all 3 there are features to substitute a string from a variable into your big string template. There is nothing useful like this in java 1.4, and so you have to put together line after line of "line1 " + var1 + "n" + ... horrible to code and maintain. Sure, there are specialized templating libraries for java, but I needed something general purpose for quick string templating.
So I used groovy for all the stuff that required the string templates, where I could use python-style triple quotes and "${varSubstitution}" in between. You can compile .groovy to java .class files and call them like any other java class as long as you include the groovy core jar in your classpath.
I think groovy would also be awesome for testing and code prototyping, although I haven't used it in those areas yet. I'm still a groovy noob, but I strongly recommend it.
BTW, I know python and ruby, and I experimented with jython and jruby for this but groovy was actually the quickest for me to figure out even though I did not know the language (and I know those others). It was the easiest for me to integrate into my existing java code.
... one more thing, I used groovy with GNU classpath+gij on linux + eclipse 3.2 (java bytecode non-native) on Debian unstable during development. I built my jar (including compiling the groovy classes) under ant. All the features that I needed worked great on this 100% free java stack. I've been using my tool at work this week on Windows+Sun java 1.4.2, and my free-java-stack-compiled version works fine.