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?
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:
gmaven-plugin
in your pom.xml
;src/main/groovy
or src/test/groovy
;For more details see building groovy projects.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With