Source file was not found during generation of report

569 views
Skip to first unread message

Justin Kolich

unread,
Sep 16, 2022, 12:36:17 PM9/16/22
to JaCoCo and EclEmma Users
I am working on a project in Kotlin using gradle. When running Jacoco I can see the code coverage of each function, but the feature where you can see a line by line analysis will not cooperate with me. 

The top of my html page says "Source file {FILE LOCATION} was not found during generation of report" however the top right section where you can see source files shows the file that I'm looking for. This means that the source file has to be found at some point, but is it being found too late in the process? I have seen some people say its because the project isn't ran in debug mode, but I have no clue how to get that set up.

Any help is appreciated! 

Marc Hoffmann

unread,
Sep 16, 2022, 1:48:52 PM9/16/22
to JaCoCo and EclEmma Users
Hi Justin,

if you get coverage figures the only problem is what the error message is: Source files cannot be found to render highlighted source code. Maybe you stepped in the following limitation with Kotlin: https://github.com/jacoco/jacoco/issues/939

JaCoCo expects source files to be in folders with the full package hierarchy. Leaving out parent folders like Kotlin compiler allows is not supported by JaCoCo.

Regards,
-marc

--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/0be709e5-7593-45c7-98fd-91869fac62e7n%40googlegroups.com.

Justin Kolich

unread,
Sep 19, 2022, 12:36:15 PM9/19/22
to JaCoCo and EclEmma Users
Marc,

Thank you for the help and I think I'm starting to understand. In my project I have a file called users.kt that can be found in src/main/kotlin/octopus, but the first line in users.kt is "package io.elephant.octopus". Would it be necessary for me to change the source tree to include Io and elephant folders?

Thank you,

Justin Kolich

Marc Hoffmann

unread,
Sep 19, 2022, 1:00:27 PM9/19/22
to jac...@googlegroups.com
Hi Justin,

exactly. If the package name is io.elephant.octopus JaCoCo will look for the source at  the folder io/elephant/octopus. As JaCoCo is not parsing source files we cannot support this feature of the Kotlin compiler.

Here is the open feature request with some background information: https://github.com/jacoco/jacoco/issues/939

Regards,
-marc

Reply all
Reply to author
Forward
0 new messages