GMaven build error with "API incompatibility encounter"

An error occurred while trying to compile my project using the Maven Gmaven plugin:

[ERROR] Failed to execute goal org.codehaus.gmaven:gmaven-plugin:1.4:compile (default) on project concorde-web: Execution default of goal org.codehaus.gmaven:gmaven-plugin:1.4:compile failed: An API incompatibility was encountered while executing org.codehaus.gmaven:gmaven-plugin:1.4:compile: java.lang.NoSuchMethodError: org.codehaus.groovy.ast.ModuleNode.getStarImports()Ljava/util/List;

Googling suggests this is due to several versions of groovy ending in my dependency chain. However, after checking the full dependency tree, I found that there is only one dependency in the full tree.

Here is an excerpt from my pom.xml:

  <!-- Groovy dependencies --> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>1.8.5</version> </dependency> <!-- ... snip ... --> <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> <version>1.4</version> <executions> <execution> <goals> <goal>generateStubs</goal> <goal>compile</goal> <goal>generateTestStubs</goal> <goal>testCompile</goal> </goals> </execution> </executions> </plugin> </plugins> 
+7
source share
3 answers

This is caused by the absence of the providerSelection element from the GMaven plugin definition.

The correct definition of GMaven is as follows:

  <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> <version>1.4</version> <configuration> <providerSelection>1.8</providerSelection> </configuration> <executions> <execution> <goals> <goal>generateStubs</goal> <goal>compile</goal> <goal>generateTestStubs</goal> <goal>testCompile</goal> </goals> </execution> </executions> </plugin> 
+13
source

With a slight modification to Marty's solution, I was able to get it working:

 <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> <version>1.5</version> <executions> <execution> <configuration> <providerSelection>2.0</providerSelection> </configuration> <goals> <goal>generateStubs</goal> <goal>compile</goal> <goal>generateTestStubs</goal> <goal>testCompile</goal> </goals> </execution> </executions> </plugin> 
0
source

The same error as in my project, but after a long diagnosis it turned out that the damaged jar, associated with a lower dependence, was damaged.

 <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>1.8.5</version> </dependency> 
0
source

All Articles