mavengroovyplexus

CompilerMojo#execute() caused a linkage error (java.lang.NoSuchMethodError) and may be out-of-date


I've searched google and reviewed answers on StackOverflow, but cannot seem to resolve this problem. I recently joined this project and added a few things to the POM. Being a relative neophyte with Maven, I am not grasping the issue and the response I have seen have not been clarifying. I suspect it is the addition of Groovy to the project. I want to use Groovy & Spock for testing (and, hopefully, eventually for prod as well).

[INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files
[FATAL ERROR] org.apache.maven.plugin.CompilerMojo#execute() caused a linkage error (java.lang.NoSuchMethodError) and may be out-of-date. Check the realms:
[FATAL ERROR] Plugin realm = app0.child-container[org.apache.maven.plugins:maven-compiler-plugin:2.0.2]
urls[0] = file:/C:/Users/bill.turner/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/2.0.2/maven-compiler-plugin-2.0.2.jar
urls[1] = file:/C:/Users/bill.turner/.m2/repository/org/codehaus/groovy/groovy-eclipse-compiler/2.7.0-01/groovy-eclipse-compiler-2.7.0-01.jar
urls[2] = file:/C:/Users/bill.turner/.m2/repository/org/codehaus/groovy/groovy-eclipse-batch/2.0.4-02/groovy-eclipse-batch-2.0.4-02.jar
urls[3] = file:/C:/Users/bill.turner/.m2/repository/org/codehaus/plexus/plexus-compiler-api/1.5.3/plexus-compiler-api-1.5.3.jar
urls[4] = file:/C:/Users/bill.turner/.m2/repository/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar
urls[5] = file:/C:/Users/bill.turner/.m2/repository/org/codehaus/plexus/plexus-compiler-manager/1.5.3/plexus-compiler-manager-1.5.3.jar
urls[6] = file:/C:/Users/bill.turner/.m2/repository/org/codehaus/plexus/plexus-compiler-javac/1.5.3/plexus-compiler-javac-1.5.3.jar
[FATAL ERROR] Container realm = plexus.core
urls[0] = file:/C:/Users/bill.turner/apache-maven-2.2.1/lib/maven-2.2.1-uber.jar
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] org.codehaus.plexus.compiler.CompilerConfiguration.getDebugLevel()Ljava/lang/String;
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NoSuchMethodError: org.codehaus.plexus.compiler.CompilerConfiguration.getDebugLevel()Ljava/lang/String;
    at org.codehaus.groovy.eclipse.compiler.GroovyEclipseCompiler.createCommandLine(GroovyEclipseCompiler.java:343)
    at org.codehaus.groovy.eclipse.compiler.GroovyEclipseCompiler.compile(GroovyEclipseCompiler.java:218)
    at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:493)
    at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Solution

  • I found my answer. I had to add a version to the maven-compiler-plugin. Answering my own question for anyone else that might be struggling with this. The clue was http://jira.codehaus.org/browse/MSITE-233

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <!-- added version here -->
        <version>2.5.1</version>
        <configuration>
            <source>1.6</source>
            <target>1.6</target>
            <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>
            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-batch</artifactId>
                <version>1.8.6-01</version>
            </dependency>
        </dependencies>
    </plugin>