How to cloverise entire project and generate db files

Kiran April 10, 2014

Hi ,

I am new to clover and we have licensed version of clover. I have added a profile in my maven pom.xml file with the following line

<plugin>
  <groupId>com.atlassian.maven.plugins</groupId>
  <artifactId>maven-clover2-plugin</artifactId>
  <configuration>
    <jdk>1.7</jdk>
    <generateHistorical>true</generateHistorical>
    <generateHtml>true</generateHtml>
    <!-- <generatePdf>true</generatePdf> -->
    <license><![CDATA[  GIVEN PROPER LICENSE ]]></license>
    <excludes>
      <exclude>**/*-mock-impl/**/*.java</exclude>
    </excludes>
    <properties>
      <clover.cloverDatabase>C:\\Users\\sample\\</clover.cloverDatabase>
      <clover.singleCloverDatabase>true</clover.singleCloverDatabase>
    </properties>
    <contextFilters>property</contextFilters>
  </configuration>
</plugin>

then I have executed following maven commands :

1) mvn clean -U : this command worked fine and is a success

2) when I tried mvn clean clover2:setup install -Dmaven.test.skip=true -Dmaven.clover.singleCloverDatabase=false is not generating clover.db files for me

I want to get functional code coverage for my project, Am I missing something or any steps you want me to add ?

Thanks,

-K

2 answers

0 votes
Kiran April 10, 2014

Hi Marek,

Thanks for the quick reply.

It didnt work for me :(

I have executed this command mvn clean clover2:setup install -Dmaven.test.skip=true

Regards,

Kiran Y

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

It seems that the

'<clover.cloverDatabase>C:\\Users\\kyajamanyam\\</clover.cloverDatabase>'

points to a directory instead of a file. Could you try appending 'clover.db' to this path?

Kiran April 10, 2014

Hi Marek,

Thanks for the quick reply.

It didnt work for me :(

I have executed this command mvn clean clover2:setup install -Dmaven.test.skip=true

Regards,

Kiran Y

Kiran April 10, 2014

I have got clover.db files under each package/target/clover/clover.db file.

Creating war files with this intrumented code will give me clover war and non clover war files?

I have got soo many clover.db files and intrumented code , it will be very difficult to add these many files to classpath

Thansk,

Kiran Y

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 10, 2014
Could you put <cloverdatabase> and <singlecloverdatabase> directly under <configuration> ?
Kiran April 10, 2014

This didnt work.

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

1) My mistake, sorry. Please use the <singleCloverDatabase> only. Do not use <cloverDatabase>, as described in maven docs:

https://docs.atlassian.com/maven-clover2-plugin/latest/setup-mojo.html#singleCloverDatabase

You will find a database in /target directory of the last compiled module.

2) You wrote that:

I have got soo many clover.db files and intrumented code , it will be very difficult to add these many files to classpath.

Please note that there is no need to add clover.db to a classpath. Instead of this, clover.db must be found by instrumented code (a path to clover.db is encoded in instrumented classes). It can be achieved by:

  • using an absolute path to clover.db or
  • using a relative path + copying clover.db to the same location relative to working directory or
  • providing -Dclover.initstring runtime property (in case when only one database is used) or
  • providing -Dclover.initstring.basedir runtime property (in case of multiple databases)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events