要使用Groovy 2.x进行编译,请尝试将其添加到gmaven插件元素中:
<configuration>
<providerSelection>2.0</providerSelection>
<source>2.0</source>
</configuration>
例如:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<providerSelection>2.0</providerSelection>
<source>2.0</source>
</configuration>
</plugin>
</plugins>
</build>
跟
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.1.9</version>
</dependency>
</dependencies>
似乎有效。