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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nava:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.