Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GMaven build fails with "An API incompatibility was encountered"

While trying to compile my project using the Maven Gmaven plugin, the following error occurred:

[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 that this is because of multiple groovy versions ending up in my dependency chain. However, after checking the full dependency tree, I find that there is only one dependency in the full tree.

Here's the excerpt of 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>
like image 954
Marty Pitt Avatar asked Oct 28 '12 21:10

Marty Pitt


Video Answer


1 Answers

This is caused by a missing providerSelection element from the GMaven plugin definition.

The correct GMaven definition looks 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>
like image 96
Marty Pitt Avatar answered Nov 10 '22 15:11

Marty Pitt