Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Making Java Groovy: Mevn description of mixed Java/groovy projects?

 
Rohan Bryant
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see Groovy as a significant improvement on Java, not merely because it adds syntactic sugar
and new language constructs (closures); but because in summary it makes it so much easier to
experiment with and cement a piece of code.

The thing that frustrates me is the Maven configuration of a mixed Java/Groovy projects.
Intuitively, I would segregate groovy and java artifacts into src/main/{java | groovy}.
Groovy best practices suggest otherwise: that I should treat a mixed Java/Groovy Maven project
simply as a groovy project. I am not comfortable mixing Java and groovy sources merely because
I have distinct developers handling groovy and Java.

What would you suggest?

Thanks,

rk
 
Kenneth A. Kousen
gunslinger & author
Ranch Hand
Posts: 100
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing will sell you on Gradle more than trying to work with Groovy and Maven together. There are two Maven plugins available for working with Groovy. One is the so-called "Groovy Eclipse" plugin, which actually has nothing to do with Eclipse, but assumes all your code (both Java and Groovy) is stored under src/main/java. The other is the GMaven project, which goes inactive for long periods of time. It generates Java stubs from all your Groovy files, and assumes that all your code (both Java and Groovy) is stored under src/main/groovy.

I might have those backwards. I'll have to look it up to be sure.

Either way, both Maven plugins put both code bases together. In Gradle I can customize it however I choose.

In one sense, though, mixing the code bases is a good thing. Oftentimes I'll have a Java class that depends on a Groovy class that depends on a Java class, and the cross-compiler makes that easy to handle.

My examples using both plugins are in the build chapter (chapter 5) of my GitHub repo.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic