Java Reference
In-Depth Information
</dependency>
</dependencies>
Next I need to add the Groovy-Eclipse plugin in a build section below the dependencies:
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.7.0-01</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
With both of these additions Maven will compile and use Groovy code appropriately, ex-
cept for one rather strange oddity. Normally I would add my Groovy classes to src/main/
groovy and any Groovy tests to src/test/groovy. According to the plugin documentation, I
can do that only if (1) there's at least one Java class in src/main/java or (2) I add a lot more
XML to specify the additional source directories.
Source directories
For the Groovy-Eclipse plugin, put Java and Groovy sources in the src/main/java and src/
test/java directories by default.
I put my Groovy files in src/main/java and src/test/java. Now I can build the project using
mvn clean install
I can even execute the project using the exec:java (!) task, both using the default
WOEID and with a supplied command-line argument:
Search WWH ::




Custom Search