It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

why does clover html report show non-instrumented code?

Kevin F May 06, 2014

I am using maven-clover plugin 3.1.12 for generating coverage reprot for our functional tests. In my pom file, I exluded some classes from instrumentation. I checked target/clover/src-instrumented directory and verified that they were not instrumented (they don't have "This file has been instrumented by Clover ..." line). However when clover generates the html report, it still shows those classes with 0% coverage and that brings down our overall coverage. What do I need to do to exclude these classes from html report and overall coverage calculation?

1 answer

0 votes
Marek Parfianowicz Atlassian Team May 07, 2014

I suspect that you do not delete the Clover database (clover.db) between builds and thus Clover still "remembers" that such class is present. And because of the fact that it's no longer instrumented, it shows 0% coverage for it.

If you keep clover.db in a standard location (in target subdirectory), then a standard 'mvn clean' should help.

Kevin F May 08, 2014

Thanks Marek, your theory is correct. Clover.db is not getting deleted. I see the following line in our hudson log when I run "mvn clean clover2:setup ....."

Updating existing database at '/home/<user>/tmp/clover/db/clover.db'

I added clover2:clean, but I still didn't get

Creating new database at '/home/<user>/tmp/clover/db/clover.db'



Then I changed clover.instrumented.db to /tmp/db/clover.db

the first time I ran my hudson job, I got

Creating new database at '/tmp/db/clover.db'

but when I ran the same job for the second time, clover again started updating the exiting file instead of creating a new one

Updating existing database at '/tmp/db/clover.db'

[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ managed-ledger --- [INFO] Deleting /home/.../target
[INFO] 
[INFO] --- maven-clover2-plugin:3.1.12:clean (default-cli) @ managed-ledger --- [INFO] 
[INFO] --- maven-clover2-plugin:3.1.12:setup (default-cli) @ managed-ledger --- [INFO] Clover Version 3.1.12, built on June 27 2013 (build-899)
[INFO] Loaded from: /home/<user>/tmp/m2-repository/com/cenqua/clover/clover/3.1.12/clover-3.1.12.jar
[INFO] Clover: Commercial License registered to ...
[INFO] Updating existing database at '/tmp/db/clover.db'.
[INFO] Processing files at 1.6 source level.
[INFO] Clover all over. Instrumented 32 files (3 packages).
[INFO] Elapsed time = 0.552 secs. (57.971 files/sec, 11,840.58 srclines/sec)

Is there any reason clover2:clean doesn't remove the exiting file when clover.db is not in its standard location?

Marek Parfianowicz Atlassian Team May 10, 2014

The clover2:clean has a <keepDb> option (default is false), can you confirm that you didn't set it to true?

Could you run 'mvn -X clover2:clean'. The debug logging should show which files/directories are being removed by clover2:clean (it removes the cloverOutputDirectory - see source code).

Nava Polk May 11, 2014

I have a similar issue, my database file is located under target maven directory but in log file there is no message of create new database file.

Only Updating existing database at ...I have the same problem. I have excluded files but they are still exists in the report and reduce the coverage.

Kevin F May 13, 2014

It seems like something is wrong on my hudson slave. When I run clover on my local box, everything works fine. Basically clover creates a new file everytime I run it.

I don't set keepDb flag option.

As a workaround , I added rm command to my driver script.

Marek Parfianowicz Atlassian Team May 14, 2014

@Nava:

  • you can call 'mvn clean' to remove the database and coverage files
  • you can also define exclusion patterns for reporting (clover2:clover + reportDescriptor)
Marek Parfianowicz Atlassian Team May 14, 2014

@Kevin:

Have you tried 'mvn -X'? Which directory is being removed by clover2:clean? I'd bet it's trying to empty <project dir>/target/clover instead of /home/<user>/tmp/clover/db/ (or /tmp/db).

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Next-gen

Introducing subtasks for breaking down work in next-gen projects

Teams break work down in order to help simplify complex tasks. This is often done iteratively, with tasks being broken down into smaller tasks and so on until the work is accurately captured in well-...

920 views 12 15
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you