Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-920

java.lang.NoSuchMethodError thrown by Clover when instrumenting Groovy code under Maven 2

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 3.0 M5, 3.0
    • 3.0 M3
    • Groovy, Maven plugin
    • None
    • Windows 7, Maven 2.0.10, Java 1.6.0_18, gmaven_plugin 1.0-rc-5, Groovy 1.6.2

      I get a fatal java.lang.NoSuchMethodError error when trying to instrument my Groovy code, running a multi-module build with Maven 2. I've tried this with 3.0.0-m3 and 3.0.0-m4r3.

      The command line is:

      mvn clover2:setup test clover2:aggregate clover2:clover
      

      The error details:

      [INFO] ------------------------------------------------------------------------
      [ERROR] FATAL ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] org.codehaus.groovy.ast.stmt.TryCatchStatement.setFinallyStatement(Lorg/codehaus/groovy/ast/stmt/Statement;)V
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      java.lang.NoSuchMethodError: org.codehaus.groovy.ast.stmt.TryCatchStatement.setFinallyStatement(Lorg/codehaus/groovy/ast
      /stmt/Statement;)V
              at com.atlassian.clover.instr.groovy.InstrumentingCodeVisitor.visitTryCatchFinally(InstrumentingCodeVisitor.java
      :813)
              at org.codehaus.groovy.ast.stmt.TryCatchStatement.visit(TryCatchStatement.java:42)
              at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:38)
              at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:129)
              at com.atlassian.clover.instr.groovy.InstrumentingCodeVisitor.visitBlockStatement(InstrumentingCodeVisitor.java:
      834)
              at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:52)
              at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:73)
              at com.atlassian.clover.instr.groovy.InstrumentingCodeVisitor.visitConstructorOrMethod(InstrumentingCodeVisitor.
      java:242)
              at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:88)
              at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:965)
              at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:48)
              at com.atlassian.clover.instr.groovy.InstrumentingCodeVisitor.visitClass(InstrumentingCodeVisitor.java:220)
              at com.atlassian.clover.instr.groovy.Grover.visit(Grover.java:215)
              at com.atlassian.clover.instr.groovy.Grover.visit(Grover.java:119)
              at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:268)
              at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:801)
              at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:466)
              at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:445)
              at org.codehaus.groovy.maven.runtime.v1_6.ClassCompilerFeature$ClassCompilerImpl.compile(ClassCompilerFeature.ja
      va:158)
              at org.codehaus.groovy.maven.plugin.compile.AbstractCompileMojo.compile(AbstractCompileMojo.java:200)
              at org.codehaus.groovy.maven.plugin.compile.AbstractCompileMojo.process(AbstractCompileMojo.java:164)
              at org.codehaus.groovy.maven.plugin.ComponentMojoSupport.doExecute(ComponentMojoSupport.java:60)
              at org.codehaus.groovy.maven.plugin.MojoSupport.execute(MojoSupport.java:69)
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:453)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:50
      0)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:479)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.jav
      a:331)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:292)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:301)
              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)
      

        1. clov-920.log
          190 kB
          Alex McManus
        2. clov-920.tar.gz
          2 kB
          Nick
        3. clov-920.zip
          4 kB
          Alex McManus

          There are no Sub-Tasks for this issue.

            [CLOV-920] java.lang.NoSuchMethodError thrown by Clover when instrumenting Groovy code under Maven 2

            Owen made changes -
            Workflow Original: New Clover Workflow [ 897769 ] New: New Clover Workflow - Restricted [ 1474338 ]
            Piotr Swiecicki made changes -
            Workflow Original: Clover Workflow [ 895739 ] New: New Clover Workflow [ 897769 ]
            Piotr Swiecicki made changes -
            Workflow Original: reviewflow [ 207769 ] New: Clover Workflow [ 895739 ]
            Marek Parfianowicz made changes -
            Affects Version/s Original: 2.6.4 [ 15053 ]
            Nick made changes -
            Fix Version/s New: 3.0 M5 [ 15131 ]
            Fix Version/s New: 3.0 [ 14870 ]
            Resolution New: Fixed [ 1 ]
            Status Original: Open [ 1 ] New: Closed [ 6 ]

            Nick added a comment -

            Thanks for confirming this, Alex!

            The Groovy Documentation for Clover does mentions which versions of Groovy we support, however this doco wont be live until we release 3.0.0. We should have mentioned this on the EAP site though - apologies.

            Nick added a comment - Thanks for confirming this, Alex! The Groovy Documentation for Clover does mentions which versions of Groovy we support, however this doco wont be live until we release 3.0.0. We should have mentioned this on the EAP site though - apologies.

            Thanks very much, I can confirm this resolves the problem (although I've just added another, CLOV-920, sorry!).

            The extra documentation would be useful - when I looked, I couldn't even find anything that stated which versions of Groovy were supported.

            Thanks again, Alex.

            Alex McManus added a comment - Thanks very much, I can confirm this resolves the problem (although I've just added another, CLOV-920 , sorry!). The extra documentation would be useful - when I looked, I couldn't even find anything that stated which versions of Groovy were supported. Thanks again, Alex.
            Nick made changes -
            Attachment New: clov-920.tar.gz [ 37306 ]

            Nick added a comment -

            The sample project, with the groovy 1.6.2 dependency added to the gmaven plugin explicitly.

            Nick added a comment - The sample project, with the groovy 1.6.2 dependency added to the gmaven plugin explicitly.

            Nick added a comment -

            Hi Alex,

            Maven is actually pulling in groovy-all-1.6.0.jar for certain parts of your build, and groovy-all-1.6.2.jar for others.

            Like the example in the tutorial/pom_completed.xml, you need to tell the gmaven plugin to use groovy 1.6.2 by defining the groovy dependency in the plugin definition itself like so:

              <plugin>
                            <groupId>org.codehaus.groovy.maven</groupId>
                            <artifactId>gmaven-plugin</artifactId>
                            <version>1.0-rc-5</version>
                            <dependencies>
                                <dependency>
                                    <groupId>org.codehaus.groovy</groupId>
                                    <artifactId>groovy-all</artifactId>
                                    <version>1.6.2</version>
                                </dependency>
                            </dependencies>
            

            Thanks for pointing this out, this is something we will need to mention in the documentation for our Groovy Maven2 plugin!

            Please let me know if you have any more questions.
            I'll attach a zip of your sample project with this change made.
            Running: mvn clean test clover2:clover produces a clover report in target/site/clover.

            Cheers,
            Nick

            Nick added a comment - Hi Alex, Maven is actually pulling in groovy-all-1.6.0.jar for certain parts of your build, and groovy-all-1.6.2.jar for others. Like the example in the tutorial/pom_completed.xml, you need to tell the gmaven plugin to use groovy 1.6.2 by defining the groovy dependency in the plugin definition itself like so: <plugin> <groupId>org.codehaus.groovy.maven</groupId> <artifactId>gmaven-plugin</artifactId> <version>1.0-rc-5</version> <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>1.6.2</version> </dependency> </dependencies> Thanks for pointing this out, this is something we will need to mention in the documentation for our Groovy Maven2 plugin! Please let me know if you have any more questions. I'll attach a zip of your sample project with this change made. Running: mvn clean test clover2:clover produces a clover report in target/site/clover. Cheers, Nick

              Unassigned Unassigned
              2aceeb5c9a94 Alex McManus
              Affected customers:
              0 This affects my team
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: