Groovy 1.1-beta-2 Released, Introduces Joint Compiler for Java & Groovy!
Posted by Jason Rudolph on July 5th, 2007
In one fell swoop, the Groovy team and JetBrains have seemingly annihilated the biggest reason (and perhaps the only reason) not to use Groovy in your Java project. With today’s release of Groovy 1.1-beta-2, you can now use the groovyc compiler to jointly compile both your Groovy and Java classes. And here’s the kicker: it manages all the dependencies for you! Groovy class A extends Java class B which references Groovy class C? No problem.

In my review of Groovy in Action, I cited this “chicken and egg dependency problem” and its potential workarounds as the one area of the book that I thought could have been stronger. This topic is just so incredibly important. Once you’re able to use Groovy and Java in the same project with zero concern about whether your build script can work out the dependencies, you’re suddenly free to explore Groovy to the fullest extent, to drop it in wherever Java feels the least bit cumbersome. Doing file I/O and don’t want the hassle of the all the plumbing needed to manage file handles and make sure you clean them up properly? No worries. Just use Groovy. Need to parse XML and cringe at the thought of walking a DOM tree or setting up a SAX parser? Problem solved. Just use Groovy. Need closures and don’t want to wait until Java 7? Ha! Java has closures today! Just use Groovy.
Jochen Theodorou offers a detailed write-up of how he and Alex Tkachman (JetBrains) worked together to develop a clever solution to this previously tedious problem. Well done, Guys. Well done.
And this feature is just one of several new improvements available in this release. (If you’re one of the many folks longing for Groovy to support the classic for loop, good news: the wait is over. But honestly, you really should give the Groovier solution a chance.) Be sure to check out Guillaume Laforge’s post for full details on this important milestone on the road to Groovy 1.1.



July 11th, 2007 at 10:29 am
yes - groovy&grails are great.
a big plus under their hood: testdriven nature.
but it’s still very hard to sell them in the trenches …
special thanks for “getting started with grails” which is a fantastic tutorial.