Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

link
GroovyObject
GroovyObject
1apidocs/groovy/lang/GroovyObject.html

 
GroovyObject|apidocs/groovy/lang/GroovyObject.html 
interface.

Compiling Groovy code to bytecode using Ant and Maven

...

You can also use the Ant task

link
from within Maven2
from within Maven2
1/display/GROOVY/Compiling+With+Maven2

,
or the

link
groovy-maven-plugin
groovy-maven-plugin
1http://mojo.codehaus.org/groovy/


...

If you don't want to explicitly compile groovy code to bytecode you can just

link
embed groovy
embed groovy
1Embedding+Groovy

directly into your Java application.

...