Maven command for clover issue

279 views Asked by At

Hi all I am using Clover to generate the code covarage report but it is always showing 0% code covarage. In sonar.sh file I run below command

sonar.sh file below

rm -f ${M2_HOME}/conf/settings.xml
cp /code/settings.xml ${M2_HOME}/conf/settings.xml 
chmod 644 ${M2_HOME}/conf/settings.xml
#mvn package
#mvn -Dmaven.wagon.http.ssl.insecure=true -s ./settings.xml -U test -Dclover=true
mvn -X -Dmaven.wagon.http.ssl.insecure=true -U -s ./settings.xml clean -U package -U test -Dclover=true
mvn clean verify sonar:sonar -Dsonar.host.url=<sonar URL>

Pom.xml file

<properties>
<clover.version>4.2.1</clover.version>
<properties>



reporting>
        <excludeDefaults>true</excludeDefaults>
            <plugins>
                <plugin>
                    <groupId>org.openclover</groupId>
                    <artifactId>clover-maven-plugin</artifactId>
                    <configuration>
                        <!--cloverDatabase>${project.build.directory}/target/clover/cloverMerge.db</cloverDatabase-->
                        <generateHtml>false</generateHtml>
                        <generatePdf>false</generatePdf>
                        <generateXml>true</generateXml>
                        <generateHistorical>false</generateHistorical>
                    </configuration>
                </plugin>
            </plugins>
        </reporting>
    
        
    <dependency>
        <groupId>org.openclover</groupId>
        <artifactId>clover</artifactId>
        <version>${clover.version}</version>
    </dependency>

        <plugin>
            <groupId>org.openclover</groupId>
            <artifactId>clover-maven-plugin</artifactId>
            <version>${clover.version}</version>
            <configuration>
                <setTestFailureIgnore>true</setTestFailureIgnore>
                <includesTestSourceRoots>false</includesTestSourceRoots>
                <targetPercentage>0%</targetPercentage>
                <debug>true</debug>
            </configuration>
            <executions>
                <execution>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>setup</goal>
                    </goals>
                </execution>
                <execution>
                    <id>aggregate</id>
                    <phase>test</phase>
                    <goals>
                        <goal>clover</goal>
                         <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

I did the googled, and found I have to set targat folder path where xml has generated. But I am not sure, where I have to put this url(target/site/clover/clover.xml)

Also, I checked below entry do I need to added in setting.xml file

<pluginGroups>
    <pluginGroup>org.openclover</pluginGroup>
</pluginGroups>

Please confirm Can Some one let me know how can run below parameter through maven

-U -s settings.xml -Dsonar.dynamicAnalysis=reuseReports -Dsonar.clover.reportPath=target/site/clover/clover.xml

Could you please help me because it ia a blocker to me.

0

There are 0 answers