Java Reference
In-Depth Information
As before, to run the program using the Maven you call the exec:java task with the
right arguments. Inthis case that means the main class iseither RunDemo or RunInJava :
> mvn exec:java -Dexec.mainClass=mjg.RunDemo
> mvn exec:java -Dexec.mainClass=mjg.RunInJava
Either way, the result is the same as in the previous section.
The GMaven project has been quiet recently, but it's still alive. As demonstrated, the arche-
type works and the stub generation allows the plugin to delegate compilation to the stand-
ard Maven tools.
Lessons learned (Maven)
1. There are two separate ways to add Groovy to Maven builds, each with benefits
and drawbacks: the “Groovy Eclipse” plugin and GMaven.
2. If at all possible, consider moving to Gradle.
5.4.3. Maven summary
There are two ways to add Groovy dependencies to a Maven project: the Groovy-Eclipse
plugin and the GMaven project. My advice (which may change as the projects evolve) is
1 . For an already existing Maven build, add the Groovy-Eclipse plugin. It works, and
a company that has a significant interest in the success of Groovy financially supports
development of the plugin itself. The fact that the name includes the word Eclipse is
irrelevant.
2 . For new projects either plugin will work, but the existence of a Maven archetype
makes it particularly easy to get started with GMaven.
3 . It's quite interesting that both plugins expect Java and Groovy sources to reside to-
gether. There's a significant integration lesson there somewhere.
Moving now from hybrid approaches to purely Groovy solutions, I'll address first the short
and sweet Grapes approach before moving to the real destination: Gradle.
Search WWH ::




Custom Search