> For the moment, I don't see either plugin going away. It'd be nice to
> combine them into a single solution, but I'm not sure how that would work or
> if it is even possible, given the somewhat different goals of each
> respective project. While I've not have any of the stub generation issues
> that seem to have been very frustrating for some (OCLC, where I work, uses
> the GMaven plugin without issue), for working with Eclipse, the
> Groovy-Eclipse compiler might be the better option. As someone that hasn't
> used Eclipse in some time, I can't really comment on that. There are some
> advantages GMaven has over the Groovy-Eclipse compiler that might important
> depending on your use case (and several of these are documented on
> Groovy-Eclipse compiler's page): you can use it to build Maven plugins, you
> can specify groovyc options to pass to the Groovy compiler, you can execute
> Groovy scripts in a pom, you can specify the exact version of Groovy to use
> for compiling (usually doesn't matter except there's breaking changes), you
> can have joint Scala/Java/Groovy projects, you have the choice between the
> Eclipse compiler and the standard Java one (if I understand how
> groovy-eclipse works they cannot do this currently, though I'm not sure if
> it matters in practice), and lastly you can run the Groovy shell or console
> without any additional installation or configuration. If none of these
> features really matter to you and you're not integrating with
> Eclipse, either option (or even groovyc with throug the antrun plugin)
> should work fine.
If the groovy-eclipse-compiler (optionally) produced stubs, then
several of these problems would go away. With the stubs, the
groovy-eclipse-compiler would be able to do things like build plugins,
produce groovydoc, etc. It may even be possible to build
java-groovy-scala projects, but I am not sure about that.
There would be a bit of work involved with stub generation, but since
the stubs would be coming from a more semantically rich model of the
groovy code than gmaven has access to, many of the stub problems that
gmaven could be avoided if the groovy-eclipse-compiler were used.
Surprisingly, we don't already have an issue logged for this in jira,
so I created one:
https://jira.codehaus.org/browse/GRECLIPSE-1438
This is not something that I will likely be able to get to in the near
future, but I will gladly mentor someone produce a (high-quality)
patch for this.
> I'm fine with the Groovy-Eclipse compiler becoming the standard Maven way of
> doing things, but there are some design issues that would have to be
> overcome. The strength of the Groovy-Eclipse compiler option is that it
> avoids stub generation, but there are cases where you actually need the
> source (such as when building a Maven plugin since they use Commons
> Attributes instead of Java5 annotations to be compatible with older versions
> of Java). Another example is if you want to use Groovy, Scala, and Java
> together, Scala would currently need Groovy's stubs unless support for Scala
> were also added to the JDT (if I'm understanding this right). This being
> the case, could/should a single tool provide two different ways of handling
> joint compilation? Do you have thoughts on this Andrew?
Inside of maven, scala code is compiled differently than it is inside
of eclipse. So, it is theoretically possible to get the scala-groovy
projects compilable in maven as long as scala can compile against
stubs. (I think this is already possible using gmaven...) We just
need to create the feature in groovy-eclipse-compiler. Note that this
would only work when running maven on the command line, and not inside
of eclipse.
> As part of a larger discussion on the Groovy compiler ecosystem (as I think
> has been stated by myself and Jason Dillon), I think the future of compiling
> Groovy should be tied to the modularization effort. That is, there should
> be a single core module that is used by Maven (be that GMaven or
> groovy-eclipse), IDEs, Ant's groovyc, etc to provide a solid and uniform
> compiling experience. This means creating a single compilation API that
> won't change from version to version. Currently there are slight variations
> between each tool (both groovy-eclipse and GMaven have at least one class
> from the core that is patched) and between the various versions of Groovy
> that the tool might want to support that seem to make the whole thing kinda
> brittle. But I don't have much experience with this stuff and don't know
> how realistic this is to expect and what impact this would have on
> groovy-eclipse.
Compared to maven and ant, Groovy-Eclipse has very different
requirements as to how to interact with code and what kind of model
should be exposed. Maven and ant are just batch compilers. They take
source and produce byte code. Groovy-Eclipse on the other hand needs
to do much more with source code (eg- create models with enough detail
to support refactoring, searching and navigation). So, groovy-eclipse
needs much more api exposed than gmaven does.
This may not really answer your question, but does explain the reason
why there are differences between the two tools.