views:

36

answers:

3

So we have some unit tests written in groovy. We have the Groovy Eclipse plugin going, we have gmaven going, but the problem is that the maven eclipse plugin doesn't automatically add the src/test/groovy directory as a source directory. So, I enlisted the build-helper plugin to add a source directory, but then the problem becomes the source directory - in eclipse, the filters will include */.java and exclude everything else, which leads to the groovy eclipse plugin being confused. I've managed to jury-rig the problem by using the build helper to add-test-resource with the right .groovy file filter. Obviously the problem here is that is not usable if we decided to use groovy classes in the projects - the .groovy classes would be included in the .jar files.

How do I fix this?

A: 

We have created m2eclipse integration for Groovy-Eclipse. First, you must install m2eclipse:

http://m2eclipse.sonatype.org/sites/m2e

Then you can install the Groovy-Eclipse integration, which you can get here:

http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/

or here for Galileo:

http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.5/

Note that the m2eclipse integration is still beta and we appreciate feedback from users to see how well it works for them.

Andrew Eisenberg
This is a great suggestion and I will be trying out the m2eclipse plugin as well. I just also wanted to cover the possibility that other developers on my team don't want to use m2eclipse or use another maven plugin in eclipse.
lakemalcom
In my experience, using m2eclipse is a much better way to manage your maven projects than using meclipse. This is because all changes to your project structure are reflected immediately inside your workspace. You do not need to re-run any maven commands to bring things up to date.
Andrew Eisenberg
A: 

I happened to check out the maven eclipse plugin page and it turns out this type of problem is already solved: http://maven.apache.org/plugins/maven-eclipse-plugin/examples/specifying-source-path-inclusions-and-exclusions.html

I ended up just using the build-helper-plugin to specify additional sources and added .groovy files to the source includes for the eclipse plugin.

lakemalcom
A: 

For another solution that does not require installing extra Eclipse plugins, you can see the following: http://contraptionsforprogramming.blogspot.com/2009/12/getting-gmaven-to-play-nicely-with.html

Andrew Eisenberg