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?
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.
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?
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).
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.
If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot