Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven compile groovy

I have a situation where some of my groovy code references my java files, but I also have different java files that reference the same groovy code. When trying to compile in maven, I either need to compile the groovy before or after the java, and that won't really work since the groovy code depends on some java files, and different java files depend on the groovy code. Is there a way to handle this sort of dependency?

like image 542
Jeff Storey Avatar asked Jun 20 '09 21:06

Jeff Storey


2 Answers

Yes, just use GMaven. Since it's a joint compiler, it automatically manages your java to groovy and groovy to java dependencies.

Briefly, you will need to:

  • include the gmaven-plugin in your pom.xml;
  • keep your groovy classes under src/main/groovy or src/test/groovy;
  • bind the gmaven plugin to the relevant lifecycle phases.

For more details see building groovy projects.

like image 196
Robert Munteanu Avatar answered Sep 29 '22 03:09

Robert Munteanu


You should be able to compile your code by adding the gmaven plugin to your maven pom.xml. It generates Java stubs of your groovy code to deal with the type of inter-language referencing you're dealing with. I use it quite a bit and it works very well.

like image 45
hohonuuli Avatar answered Sep 29 '22 05:09

hohonuuli