Clover.db files not being generated for groovy modules

Bailey Ammons July 22, 2014

I am using the maven-clover2-plugin and groovy-eclipse-compiler. Clover version 4.0.0. When I run setup test or instrument I can see that it is trying to create the clover.db file, but it just prints that it's being created several times to terminal and never actually creates it.

Because of this when I go to generate reports, I only see coverage for about a third of the project. I can't show any logs due to this being a company project, but any help would be appreciated.

1 answer

0 votes
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 23, 2014

I recommend reading the following article:

I also suggest to have a look at code samples in

(it's a Mercurial repository), folders:

  • src/it/groovy-eclipse-plugin
  • src/it/groovy-eclipse-plugin-src-main-groovy
  • src/it/groovy-eclipse-plugin-src-main-java
Bailey Ammons July 23, 2014

For clarification I already have groovy and java compiling/instrumented with the groovy eclipse plugin. I also have already read all of the suggested material. Everything appears to be building just fine, but it won't generate the clover.db files for modules that only have groovy in them.

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 23, 2014

When I run setup test or instrument I can see that it is trying to create the clover.db file, but it just prints that it's being created several times to terminal and never actually creates it.

At the moment when clover2:setup or clover2:instrument is called, it just prints information about planned location of the Clover database.

Database will be created/updated during code compilation, i.e. javac or groovyc must be called.

Did you call the 'compile' or 'test' phase after the clover2:setup? Do you see that javac/groovyc has compiled your sources? I'm asking because it's a quite frequent mistake to call clover2:setup but not to compile any sources. :-)

Bailey Ammons July 23, 2014

It's alright. And the exact command sequence that I am running is:

mvn clean clover2:setup test clover2:aggregate clover2:clover

Before it goes to run the tests I can see it trying to repeatedly create the database and after it's running the tests I can see it try to create it again. All of my java modules and java/groovy modules compile, instrument fine, and create the db file, it's just the groovy only modules that don't seem to be able to create the database. I can see they are compiled and tested and I have an instrumentation.ser file in the classes folder, but nothing under the clover folder.

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 3, 2014

PS: feel free to raise a ticket at support.atlassian.com, attaching logs and build files. having more data may help to resolve it faster.

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 3, 2014

Could you tell:

  • in which folder(s) do you keep your *.groovy sources (especially in modules containing only groovy code)
  • how did you configure the groovy-eclipse-plugin? could you paste a snippet from your pom.xml?
  • do you add any extra source folders, e.g. using the build-helper-maven-plugin?

Could you also enable a debug logging (mvn -X or -Dmaven.clover.debug=true) and see whether Clover prints any messages for groovy-only modules?

Bailey Ammons August 3, 2014

all groovy sources are in src/main/groovy and src/test/groovy

<build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <compilerId>groovy-eclipse-compiler</compilerId>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-compiler</artifactId>
            <version>2.8.0-01</version>
          </dependency>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-batch</artifactId>
            <version>2.1.8-01</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-eclipse-compiler</artifactId>
        <version>2.8.0-01</version>
<extensions>true</extensions> </plugin> <plugin> <groupId>com.atlassian.maven.plugins</groupId> <artifactId>maven-clover2-plugin</artifactId> <version>${clover.version}</version> <configuration> <licenseLocation>/root/path/to/.m2/clover.license</licenseLocation> <generateHtml>true</generateHtml> <historyDir>/root/path/to/clover_history/${project.artifactId}</historyDir> <historyThreshold>2%</historyThreshold> </configuration> </plugin> </plugins> </build>

actual path inserted where /root/path/to is.

After the build is finished, the clover folder where all the db files should be is empty and there is only an index.html file for the report.

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2014

After the build is finished, the clover folder where all the db files should be is empty

According to your code snippets, you should actually see clover.db in /target subdirectory in every module containing Java and/or Groovy code. In addition to this, you shall see an aggregated database in a <project_root>/target directory.

and there is only an index.html file for the report.

Are you sure that this is an index.html file generated by Clover and not by JUnit (maven-surefire-plugin)?

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2014

1) What Maven and Java version do you use?

2) Does your POM contain declaration of Groovy version to be used? E.g.:

&lt;dependency&gt;
  &lt;groupId&gt;org.codehaus.groovy&lt;/groupId&gt;
  &lt;artifactId&gt;groovy-all&lt;/artifactId&gt;
  &lt;version&gt;2.3.6&lt;/version&gt;
&lt;/dependency&gt;

If yes, then which Groovy version do you use?

3) What happens when you run your build with 'mvn -X' (debug logging)? Do you see any Clover-related messages for your pure-Groovy modules?

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 23, 2014

Hi Bailey, did you have a chance to check my last three questions? I'd love to help!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events