I want to write a Maven plugin in Groovy, but under Eclipse (Galileo).
- I've downloaded and installed Groovy-Eclipse plugin
- I've created my very simple POM file (included below).
- I've created a simple Echo mojo and place it under "/src/main/groovy/com/acme/maven/plugins/foo".
- I performed "Import Existing Maven Project" in Eclipse (using M2Eclipse plugin).
The problem is that I don't see "src/main/gro开发者_运维技巧ovy" as a source folder, which makes it hard to develop: - I have to create the package directory structure (com/acme/maven/plugins/foo) manually - Refactoring probably won't work easily - Incremental probably won't work.
How do you guys develop your Maven plugins using Groovy in Eclipse?
You should definitvly install the Groovy-Eclipse plugin if you plan to develop Groovy code in Eclipse. You can find all the details here:
http://groovy.codehaus.org/Eclipse+Plugin
You should also add the Groovy Maven Plugin to your pom.xml
like this (see this page for details):
<build>
<plugins>
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Now update your Eclipse project configuration via Right-click on project -> Maven -> Update project configuration
. Now you should see that the src/main/groovy
folder has been added to the source folders.
Use GMaven and the eclipse plugin as suggested by chkal.
In addition to GMaven, and Groovy-Eclipse, there is m2eclipse support for Groovy-Eclipse that should be installed separately. Go to the Groovy-Eclipse snapshot update site:
http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/
And install the feature from there. This feature will ensure that your groovy/maven projects are set up correctly when they are imported.
精彩评论