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

The
linkgroovycgroovyc1http://docs.codehaus.org/display/GROOVY/Groovyc+Ant +Task groovycAnt task is implemented by the

link
Groovyc
Groovyc
1apidocs/org/codehaus/groovy/ant/Groovyc.html

class. You can see an example of this in action inside Groovy's maven.xml file (just search for 'groovyc')

...

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/



...