This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other Languages and the fly likes Groovy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "Groovy" Watch "Groovy" New topic
Author

Groovy

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

http://groovy.codehaus.org/
Has anyone had a chance to look at this new scripting language? It looks pretty nice, but I am no expert.


GenRocket - Experts at Building Test Data
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Hint: there has been a discussion going on at TSS for a couple of days.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Lasse Koskela:
Hint: there has been a discussion going on at TSS for a couple of days.

http://www.theserverside.com/home/thread.jsp?thread_id=22863#104076
Is that the one you are talking about?
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Yes. I was just too lazy to fetch the link
(for some reason, my Mozilla requires a reload after clicking a link at TSS; otherwise I won't see any content...)
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I've been trying to get groovy working for anything except manual scripting for s few days with not much luck. The installation and usage documentation is almost nonexistent. I'm worried that I may have something set up wrong, because I can't even get groovy to run its own test suite.
In particular, has anyone got the ant "groovyc" task working? I keep getting cryptic classloader errors from ant.
I really like the idea, though, and I'm itching to use it!


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Frank Carver:
I've been trying to get groovy working for anything except manual scripting for s few days with not much luck. The installation and usage documentation is almost nonexistent. I'm worried that I may have something set up wrong, because I can't even get groovy to run its own test suite.
In particular, has anyone got the ant "groovyc" task working? I keep getting cryptic classloader errors from ant.
I really like the idea, though, and I'm itching to use it!

I'm with you. I haven't been able to even get an echo ANT task to work without getting some strange exception. But Groovy looks exciting and promising. I am running the groovysh console and I type in the following commands:

And the output I get is:

And I am not sure if that is normal behavior or not. But it really needs some better documentation. As usual though, an Open Source project with crap documentation doesn't surprise me.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
OK. More evaluation tidbits I thought I'd ahare.
The major issue I had with ant was in getting the add-in ant task "groovyc" to work without "class not found" errors. There is an elliptical mention on the groovy site:

However, there are a few issues with this. One problem is that the "groovyc" task requires "asm.jar" and "asm-util.jar" (from objectweb.org), but it doesn't say that anywhere in the documentation. Another problem is that the supplied groovyc task doesn't work with the latest versions of these jars. And so on. Eventually, though, I got this process working and generating class files.
Unfortunately, I am a little disappointed. Despite the claims on the groovy website, the generated classes are not independently usable. To run a class file generated by groovy, you need to have the groovy jar in the classpath. That's kind of acceptable - I can see the advantage of providing run-time suport for groovy features. Worse, though, is the requirement to have the asm jar file in the classpath! Surely, asm is only needed when compiling, not when runnig a class. That's like having to deliver Sun's "tools.jar" with every 1k "hello world" class file.
Looking at the groovy source code, the main problem seems to be that the small and innocuous "GroovyObject" interface includes a reference to the huge, tangled, and concrete "MetaClass" class. For lightweight deployment this should definately be at most an interface, and ideally not mentioned at all.
I'm probably going to take this up with the groovy developers. I have this feeling that they have forgotten that they always have asm in their development classpaths, and have not noticed the crazy run-time dependency.
[ December 17, 2003: Message edited by: Frank Carver ]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Good catch Frank! I hope you have some success with the developers. I think Groovy could be very cool, if it works.
Roby Gamboa
Greenhorn

Joined: Feb 05, 2004
Posts: 1
Hi, all:
My original thought on reading the post was that you were talking about a compilation problem in Groovy itself, in which case you could resolve it using Maven instead of Ant to perform the build of Groovy.
In re-reading the post, though, am I to understand that the Asm dependency is a runtime dependency? It seems you could get around the dependency the same way the Groovy developers did: convert your build process to use Maven projects. Definitely overkill for anything less than a full production system, though. Certainly makes prototyping a pain...
[ February 05, 2004: Message edited by: Roby Gamboa ]
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Yes, it's a runtime dependency.
Asm is required to run (ie compile and execute) Groovy scripts, and is an essential component of being able to directly run groovy script (source) files. I can live with that.
However, I want to use the supplied "groovyc" task to pre-compile Groovy source code into regular Java classes, so I can use them with my existing Java code. Unfortunately, even these precompiled classes have a load-time dependency on asm.
It may be a crazy wish, but I want to be able to compile Groovy code to regular Java classes, with no hidden dependencies. If I don't use something in my code, I don't want the generated classes to need it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Groovy
 
Similar Threads
Call groovy program from Java
what are the IDE support Groovy ?
Core Java 2, Volume I book - Reader question
How to work with Xml using Groovy
setHeaders