Compilation of the Groovy class with existing java classes?

advertisements

I have existing java web application. Now I have written a groovy hello world class. How should I compile it with existing java class? From http://groovy.codehaus.org/ looks like I need a different compiler for this as command is groovy -e "println 'Hello ' + args[0]" World instead use javac.

I want to compile command from both command prompt and eclipse so that groovy class gets compiled with existing java classes.


If you're building with Eclipse I guess you need to install the Groovy plugin and make sure it is seeing your project as a groovy project.

I'm not sure how to do this, as like Arturo, I just use Sublime Text and the command line.

For compiling from the command line, you should be using something like Ant (documentation can be found here for the groovyc task and cross-compiling with Java), or Gradle (documentation here on the Groovy plugin)