Sourcepath property is not working for maven Clover Report with clover version 4.0.0

Ramesh November 9, 2015

Clover database is generated on my Mac and trying to  generate report on target server where our automation runs.Getting errors for all the java filed and no coverage report

ERROR: Failed to render syntax highlights for /.....

Noticed similar issue at https://jira.atlassian.com/browse/CLOV-1415

Tried to add sourcepath element in my maven clover configuration and still problem is not solved

Given below my POM example

Using clover version - 4.0.0

Coped  custom_clover_report_descriptor.xml in parent module

<custom.clover.report.descriptor.location>../custom_clover_report_descriptor.xml</custom.clover.report.descriptor.location


When I run in debug mode mvn -X -> I see source files are picking up and saying "FOUND".

Not sure what else I am missing here. Need your help.

POM.xml

=========

 

<build>

 

                <plugins>

 

                    <plugin>

 

                        <groupId>com.atlassian.maven.plugins</groupId>

 

                        <artifactId>maven-clover2-plugin</artifactId>

 

                         <version>${clover.version}</version>

 

                        <configuration>

 

                            <cloverOutputDirectory />

 

                            <flushPolicy>threaded</flushPolicy>

 

                             <flushInterval>100</flushInterval>

 

                            <failOnViolation>false</failOnViolation>

 

                            <alwaysReport>true</alwaysReport>

 

                            <jdk>1.8</jdk>

 

                            <licenseLocation>${clover.licenselocation}</licenseLocation>

 

                            <generateHtml>true</generateHtml>

 

                            <generateXml>true</generateXml>

 

                            <includesTestSourceRoots>false</includesTestSourceRoots>

 

                            <singleCloverDatabase>true</singleCloverDatabase>

 

                            <reportDescriptor>${custom.clover.report.descriptor.location}</reportDescriptor>

 

 

                        </configuration>

 

                        <executions>

 

                         <execution>

 

                             <id>clover</id>

 

                             <goals>

 

                                 <goal>setup</goal>

 

                                 <goal>snapshot</goal>

 

                             </goals>

 

                         </execution>

 

                         <execution>

 

                             <phase>verify</phase>

 

                             <goals>

 

                                 <goal>aggregate</goal>

 

                                 <goal>clover</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>

 

                              <contextFilters>static</contextFilters>

 

                        </configuration>

 

                    </plugin>

 

                  </plugins>

 

             </reporting>


custom_clover_report_descriptor.xml

================================

<project name="Clover Report" default="current">

 

    <clover-format id="clover.format" type="${type}" orderBy="${orderBy}" filter="${filter}" reportStyle="${reportStyle}"/>

 

    <clover-setup initString="${cloverdb}"/>

 

    <fileset id="test.sources" dir="${projectDir}">

        <include name="${testPattern}"/>

    </fileset>

 

    <clover-columns id="clover.columns">

        <totalChildren/>

        <filteredElements/>

        <avgMethodComplexity/>

        <uncoveredElements format="raw"/>

        <totalPercentageCovered format="longbar"/>

    </clover-columns>

 

    <target name="historical">

        <clover-report>

            <current outfile="${output}" summary="${summary}"

                     charset="${charset}" title="${title}" titleAnchor="${titleAnchor}"

                     span="${span}" alwaysReport="${alwaysReport}"

                     showInnerFunctions="${showInnerFunctions}" showLambdaFunctions="${showLambdaFunctions}">

                <format refid="clover.format"/>

                <testsources refid="test.sources"/>

                <columns refid="clover.columns"/>

            </current>

            <historical outfile="${historyout}" historydir="${history}"

                        charset="${charset}" title="${title}" titleAnchor="${titleAnchor}"

                        span="${span}">

                <format refid="clover.format"/>

            </historical>

        </clover-report>

    </target>

 

    <target name="current">

        <clover-report>

            <current outfile="${output}" summary="${summary}"

                     charset="${charset}" title="${title}" titleAnchor="${titleAnchor}"

                     span="${span}" alwaysReport="${alwaysReport}"

                     showInnerFunctions="${showInnerFunctions}" showLambdaFunctions="${showLambdaFunctions}">

                <format refid="clover.format"/>

                <testsources refid="test.sources"/>

                <columns refid="clover.columns"/>

                <sourcepath>

                    <pathelement location="${projectDir}/src/main/java"/>

                    <!-- <pathelement path="src/main/java"/> -->

                    <!-- <dirset dir=".">

                        <include name="**/src/main/java" />

                    </dirset> -->

                </sourcepath>

            </current>

        </clover-report>

    </target>

</project>

 

 

 

2 answers

0 votes
Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 12, 2015

OK, sorry I assumed you're using maven integration. 

HtmlReporter is accepting --sourcepath command line argument. Have you tried to use it?

If it won't help please run the command with --debug argument and attach output here, e.g.

java -cp clover.jar com.atlassian.clover.reporters.html.HtmlReporter -i clover.db -o clover_html --sourcepath &lt;path&gt; --debug &gt; output.txt
Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 16, 2015

OK, so basically saying, Clover during report generation is using source files in order to generate report. It may be generated without using source files, but not all data will be available. The path to source file is being saved in {{clover.db}}, but it can be modified via {{sourcepath}} attribute. In you case it's hard to tell what's happening at the moment. I don't know the reason of the fail you've provided. I need at least full error message with stacktrace, but please provide debug logs from report generation during your process ({{--debug}} argument), redirect output to some file and attach it here.

Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 17, 2015

OK, this is becoming completely unreadable, this system wasn't designed to process such outputs. Please rise an issue on https://support.atlassian.com portal and provide the same output from HtmlReported. Please note that logs especially debug logs produce a lot of data. Please redirect the output of that command to some file and attach that file to an issue created on https://support.atlassian.com

0 votes
Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 10, 2015

You've wrote you're getting errors saying:

ERROR: Failed to render syntax highlights for /.....

Could you run 

mvn -X clover2:clover > output.log

on target server and attach the output file here ? I don't know what's the reason why the report generation fails currently.

 

NOTE: Remember, all data here all publicly available, if you're concerned about your privacy, then please create a support ticket in https://support.atlassian.com and attach log file there. 

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events