• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
gunslinger & author
Posts: 169
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
The problems of the world fade way as you eat a piece of pie. This tiny ad has never known problems:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic