Jacoco.html is empty with 'No class files specified'

5,282 views
Skip to first unread message

ragulra...@gmail.com

unread,
Mar 25, 2020, 4:37:00 AM3/25/20
to JaCoCo and EclEmma Users
Hi All,

I am trying to generate my coverage report using Jacoco plugin - which will in turn generate jacoco.html as output. But the file is empty with the msg stating "No class files specified" like below.


jacoco.pngjacocosession.png



These are the below configuration I have regarding sonar and Jacoco


Jacoco Configuration:

<org.jacoco.version>0.8.5</org.jacoco.version>
      <profile>
            <id>sonar-coverage</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>3.3.0.603</version>
                </plugin>
            </plugins>
        </build>
    </profile>

    <profile>
        <id>jacoco</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${org.jacoco.version}</version>
                    <configuration>
                        <append>true</append>
                    </configuration>
                    <executions>
                        <execution>
                            <id>agent-for-unit-test</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>agent-for-integration-test</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>prepare-agent-integration</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>jacoco-site</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>    


Sonar Configuration:


<sonar.language>java</sonar.language>
<sonar.verbose>true</sonar.verbose>
<sonar.sourceEncoding>UTF-8</sonar.sourceEncoding>
<sonar.java.source>8</sonar.java.source>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>


Am I missing any configuration related to the Jacoco plugin?

Evgeny Mandrikov

unread,
Mar 25, 2020, 7:01:26 AM3/25/20
to JaCoCo and EclEmma Users
Hi,

Your partial snippet of configuration is not different from many others that work. Why do you exclude the possibility that your problem lies outside of this partial configuration?

Partial snippets are not debuggable.

Please stop asking about partial snippets and always provide a complete example.

And BTW configuration for Sonar has nothing to do with the generation of JaCoCo HTML report.

ragul rangarajan

unread,
Mar 26, 2020, 12:10:49 PM3/26/20
to jac...@googlegroups.com
Hi team,

sorry, Evgeny for the partial snippet.

Now I upload the sample module with my Jacoco configuration in Github.

In my analysis, I could see the below behavior.
With the pom.xml https://github.com/Ragulrangarajan/MathOperationJacoco/blob/master/pom.xml, I could generate the Jacoco.html as expected.
The page shows as empty with the msg stating "No class files specified" as below.
withincludetag.png
But when we remove the <include>..</include> from the plugin configuration I could see the Jacoco report as expected.
withoutincludetag.png

I am a bit confused about the above behavior. Can you please help on this to clarify this behavior?
Or Am I missing something?

Thanks and Regards,
Ragul

--
You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/aKGwrKNIin8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/c2620a33-6471-4c90-8f8f-9997ff290845%40googlegroups.com.

Evgeny Mandrikov

unread,
Mar 26, 2020, 12:18:36 PM3/26/20
to JaCoCo and EclEmma Users
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <configuration>
                    <includes>
                        <include>math.operation</include>
                    </includes>
                </configuration>

Configures both mojos at the same time with pattern that doesn't match nor class names, nor class files.


To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.

ragul rangarajan

unread,
Mar 27, 2020, 11:51:20 AM3/27/20
to jac...@googlegroups.com
Thanks, Evgeny for the messed pattern. (Corrected now)

But I also able to see the include-pattern should be MavenName / FileName - math/operation/* (Jacoco report was generated)
and not as JavaName: math.operation.* (Jacoco report not generated)

After using MavenName in include-pattern now my report is generated. Hope this is the expected behavior.

Thanks and Regards,
Ragul


To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/aKGwrKNIin8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/6e0885a2-9eac-4ede-866c-6940ecdc68c9%40googlegroups.com.

Evgeny Mandrikov

unread,
Apr 4, 2020, 6:52:05 AM4/4/20
to JaCoCo and EclEmma Users


On Friday, March 27, 2020 at 4:51:20 PM UTC+1, ragul rangarajan wrote:
Thanks, Evgeny for the messed pattern. (Corrected now)

But I also able to see the include-pattern should be MavenName / FileName - math/operation/* (Jacoco report was generated)
and not as JavaName: math.operation.* (Jacoco report not generated)

After using MavenName in include-pattern now my report is generated. Hope this is the expected behavior.


This is expected behavior:

as written in https://www.jacoco.org/jacoco/trunk/doc/prepare-agent-mojo.html#includes "prepare-agent-mojo" uses class names


            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <configuration>
                    <!-- affects configuration of any execution inclugin both "prepare-agent" and "report" below -->
                </configuration>
                <executions>
                    <execution>
                        <id>agent-for-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <!-- affects configuration of only this execution of "prepare-agent" -->
                        </configuration>
                    </execution>
                    <execution>
                        <id>jacoco-site</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <!-- affects configuration of only this execution of "report" -->
                        </configuration>


 

Thanks and Regards,
Ragul


To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/aKGwrKNIin8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages