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

Clover does not instrument groovy source files, (groovy-eclipse compiler) when located in src/main/groovy

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 3.1.12
    • 3.1.7
    • Groovy, Maven plugin
    • None

      When building a groovy project with maven, I am trying to get clover code coverage reports. With all source files in .java and in src/main/java, clover works fine. However, with all source files in .groovy and in src/main/groovy, clover can not instrument the files (clover2:instrument, or clover2:setup).

      Everything that I can find is saying that clover versions after 3.1.3 support the maven groovy eclipse compiler (so long as the groovy files are located in src/main/groovy). See this ticket: https://jira.atlassian.com/browse/CLOV-1021?page=com.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel

      There is another support ticket that I found that seems to cover the same issue, however I cannot access it. Here is the link
      https://support.atlassian.com/browse/CLV-5878

      A partial output log is included here. I will try to come up with a small test project that I can upload here. Any help would be appreciated.

        1. cloverfailure.rtf
          4 kB
        2. GroovyPrefixCalc.zip
          49 kB

            [CLOV-1150] Clover does not instrument groovy source files, (groovy-eclipse compiler) when located in src/main/groovy

            Clover-for-Maven version 3.1.12 including this fix was just released.

            Marek Parfianowicz added a comment - Clover-for-Maven version 3.1.12 including this fix was just released.

            Hi Pavan,

            I know about two bugs related with Groovy causing lack of instrumentation:

            https://jira.atlassian.com/browse/CLOV-1195
            https://jira.atlassian.com/browse/CLOV-1062

            In case when you're using the Clover-for-Grails plugin, the exclusion/inclusion filters can affect scope of instrumentation too:
            https://bitbucket.org/atlassian/grails-clover-plugin/src/cb55c2e4cddf5f78ee6e2968d6dabaada86d38e2/scripts/_Events.groovy?at=grails

            I do not have any Spring 3.x list of annotations supported by Clover, unfortunately.

            Cheers
            Marek

            Marek Parfianowicz added a comment - Hi Pavan, I know about two bugs related with Groovy causing lack of instrumentation: https://jira.atlassian.com/browse/CLOV-1195 https://jira.atlassian.com/browse/CLOV-1062 In case when you're using the Clover-for-Grails plugin, the exclusion/inclusion filters can affect scope of instrumentation too: https://bitbucket.org/atlassian/grails-clover-plugin/src/cb55c2e4cddf5f78ee6e2968d6dabaada86d38e2/scripts/_Events.groovy?at=grails I do not have any Spring 3.x list of annotations supported by Clover, unfortunately. Cheers Marek

            Hi Marek,

            That is useful information. I generated the clover report and looked through the details. I see that clover IS reporting coverage for SOME of the groovy files. While it is reporting non-zero coverage for the 'plain' (non annotated) groovy files, it is reporting zero coverage for files uing various Spring and Groovy annotations such as @Controller, @PreAuthorize, @Commons etc. I am pretty sure my tests exercising these parts of the code. Are there any issues with collecting/reporting coverage numbers for Groovy files with Spring annotations? Is there a list of supported Spring annotations? We are using Spring 3.X.

            Thanks,
            Pavan

            Pavan Kumar Bagepalli added a comment - Hi Marek, That is useful information. I generated the clover report and looked through the details. I see that clover IS reporting coverage for SOME of the groovy files. While it is reporting non-zero coverage for the 'plain' (non annotated) groovy files, it is reporting zero coverage for files uing various Spring and Groovy annotations such as @Controller, @PreAuthorize, @Commons etc. I am pretty sure my tests exercising these parts of the code. Are there any issues with collecting/reporting coverage numbers for Groovy files with Spring annotations? Is there a list of supported Spring annotations? We are using Spring 3.X. Thanks, Pavan

            Hi Pavan,

            Clover does not instrument *.groovy files on a source level, but it modifies the AST (abstract syntax tree). It means that you will not find any *.groovy files in src-instrumented directory. In order to check if groovy files were instrumented, please generate HTML report and check if groovy files are present in it.

            Cheers
            Marek

            Marek Parfianowicz added a comment - Hi Pavan, Clover does not instrument *.groovy files on a source level, but it modifies the AST (abstract syntax tree). It means that you will not find any *.groovy files in src-instrumented directory. In order to check if groovy files were instrumented, please generate HTML report and check if groovy files are present in it. Cheers Marek

            Thanks Marek. I looked up the samples and I think what we are doing/using is not a special case. I used this https://bitbucket.org/atlassian/maven-clover2-plugin/src/dd6db4b661e6d9893c9d51744ee492720ed42ba5/src/it/groovy-eclipse-plugin/pom.xml as my reference.

            We have java code under src/main/java and groovy code under src/main/groovy, which are the defaults supported by both the groovy plugin and the clover plugin. Interestingly, when I generate the debug log file via "mvn -X -e -Dclover.debug=true clover2:setup" I see the following log which indicates that the groovy files are being included for instrumentation.

            [DEBUG] Clover including the following files for Groovy instrumentation:

            Infact, I see the groovy file inclusion even without using the help of the build-helper-maven-plugin or the extensions=true feature of the groovy-eclipse-compiler-plugin. But, I don't see the instrumented sources for any of the groovy files under target/clover/src-instrumented. I can see the instrumented sources for only the .java files. I am getting this behaviour with both v3.1.11 and the 3.1.12-SNAPSHOT

            Pavan Kumar Bagepalli added a comment - Thanks Marek. I looked up the samples and I think what we are doing/using is not a special case. I used this https://bitbucket.org/atlassian/maven-clover2-plugin/src/dd6db4b661e6d9893c9d51744ee492720ed42ba5/src/it/groovy-eclipse-plugin/pom.xml as my reference. We have java code under src/main/java and groovy code under src/main/groovy, which are the defaults supported by both the groovy plugin and the clover plugin. Interestingly, when I generate the debug log file via "mvn -X -e -Dclover.debug=true clover2:setup" I see the following log which indicates that the groovy files are being included for instrumentation. [DEBUG] Clover including the following files for Groovy instrumentation: Infact, I see the groovy file inclusion even without using the help of the build-helper-maven-plugin or the extensions=true feature of the groovy-eclipse-compiler-plugin. But, I don't see the instrumented sources for any of the groovy files under target/clover/src-instrumented. I can see the instrumented sources for only the .java files. I am getting this behaviour with both v3.1.11 and the 3.1.12-SNAPSHOT

            Hi Pavan,

            Please have a look at the https://bitbucket.org/atlassian/maven-clover2-plugin, directory src/it. You'll find code samples:

            • gmaven-plugin
            • gmaven-plugin-no-java
            • groovy-eclipse-plugin
            • groovy-eclipse-plugin-src-main-groovy
            • groovy-eclipse-plugin-src-main-java

            Cheers
            Marek

            Marek Parfianowicz added a comment - Hi Pavan, Please have a look at the https://bitbucket.org/atlassian/maven-clover2-plugin , directory src/it. You'll find code samples: gmaven-plugin gmaven-plugin-no-java groovy-eclipse-plugin groovy-eclipse-plugin-src-main-groovy groovy-eclipse-plugin-src-main-java Cheers Marek

            I am using a trial license of Clover and hit this problem with maven-clover2-plugin version 3.1.11. I found this JIRA entry via a web search and tried out the 3.1.12-SNAPSHOT version and I still cannot get clover to instrument my groovy files under src/main/groovy.

            Pavan Kumar Bagepalli added a comment - I am using a trial license of Clover and hit this problem with maven-clover2-plugin version 3.1.11. I found this JIRA entry via a web search and tried out the 3.1.12-SNAPSHOT version and I still cannot get clover to instrument my groovy files under src/main/groovy.

            Hello Aaron, a fix for your bug is ready. You can test it using maven-clover2-plugin version 3.1.12-SNAPSHOT. Cheers!!!

            Marek Parfianowicz added a comment - Hello Aaron, a fix for your bug is ready. You can test it using maven-clover2-plugin version 3.1.12-SNAPSHOT. Cheers!!!

            This case was handled on support page.

            Marek Parfianowicz added a comment - This case was handled on support page.

            Thanks a lot for a test case, I'll check what's wrong.

            Marek Parfianowicz added a comment - Thanks a lot for a test case, I'll check what's wrong.

              mparfianowicz Marek Parfianowicz
              f1c627903a03 Aaron Armistead
              Affected customers:
              0 This affects my team
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: