views:

255

answers:

1

I have some legacy Java code inside which I'd like to call a groovy Closure.

Is this something that the Java / Groovy cross-compiler will be able to handle? I suspect it compiles Java first, but does it do another pass over the Groovy bytecode to resolve all the java references.

Or do I need to compile the class with closure first into a jar, so that I can access it from Java?

+1  A: 

I see this for mixing Java and Groovy :
Mixed Java and Groovy Applications

This example looks at the issues surrounding a mixed Java/Groovy application. This issue only arises when there is mutual dependencies between your mixed language source files. So, if part of your system is pure Java for instance, you won't have this problem. You would just compile that part of your system first and reference the resulting class/jar file(s) from the part of your system that was written in Groovy.

SjB
Thanks - that's just what I need!
Jean Barmash