There are various options for compiling Groovy code and then either running it or using the Java objects it creates in Java code.
Compling Groovy code to bytecode using a script
There is an Ant task called groovyc which works pretty similarly to the javac Ant task which takes a bunch of groovy source files and compiles them into Java bytecode. Each groovy class then just becomes a normal Java class you can use inside your Java code if you wish.
Indeed the generated Java class is indistinguishable from a normal Java class, other than it implements the
Compiling Groovy code to bytecode using Ant and Maven
There is also an excellent
You can also use the Ant task
Dynamically using Groovy inside Java applications
If you don't want to explicitly compile groovy code to bytecode you can just
As well as Java 1.4 and the Groovy jar we also depend at runtime on the ASM library (asm and asm-tree mainly), as well as Antlr. You can also use the groovy-all-xxx.jar from your GROOVY_HOME/embeddable directory, which embeds ASM and Antlr in its own namespace, to avoid Jar version hell.