PRATHAP S
PRATHAP S

Reputation: 775

Not able to generate HTML reports of code coverage from Clover Maven plugin

Trying to integrate Clover maven plugin to get the code coverage of my project.

After I build my project with mvn clean install, target folder looks like below

enter image description here

But I am looking for code coverage with HTML reports (Which will give us the code coverage with package wise, class wise views)

Will the line <generateHtml>true</generateHtml> does it ?, if yes, something wrong in my configuration.

How can I get HTML reports out of Clover maven plugin?

Below is the pom.xml code

<build> 
         <plugins>
            <plugin>
        <groupId>com.atlassian.maven.plugins</groupId>
        <artifactId>maven-clover2-plugin</artifactId>
        <configuration>
        <!-- <targetPercentage>80%</targetPercentage> -->
        <generateHtml>true</generateHtml>
          <generatePdf>true</generatePdf>
          <generateXml>true</generateXml>
        </configuration>
        <executions>
          <execution>
             <phase>verify</phase>
            <goals>
               <goal>instrument</goal>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
        </plugins>
    </build>
    <reporting>
    <plugins>
      <plugin>
        <groupId>com.atlassian.maven.plugins</groupId>
        <artifactId>maven-clover2-plugin</artifactId>
        <configuration>
        <generateHtml>true</generateHtml>
          <generatePdf>true</generatePdf>
          <generateXml>true</generateXml>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

Upvotes: 1

Views: 2377

Answers (1)

Jagan N
Jagan N

Reputation: 2065

Please use mvn clean install clover2:clover command ad see if you get the html report generated in target/site/clover/index.html file.

The clover2:clover goal should instrument your test classes, execute the test cases and record the code coverage information.

Upvotes: 1

Related Questions