cli report generation: Source file not found during generation of report

991 views
Skip to first unread message

Rafer Gluyas

unread,
Jul 21, 2021, 8:18:23 PM7/21/21
to JaCoCo and EclEmma Users
I've got a fairly decent sized project that is made up of different modules, each in their own folder. 

root - 
            |__ ModuleA
                                       |__ src/java
            |__ ModuleB
                                       |__ src/java
            |__ ModuleC
                                       |__ src/java

The project is built using ant, and has the debug=true flag set on (so the line number should be included by default). 

This is my CLI to generate the report (inside of a script in bamboo).  
java -jar /node/bud48/bin/jacoco-0.8.6/lib/jacococli.jar report ${bamboo.nodeTempDir}/${bamboo.planKey}/${bamboo.buildNumber}/*.exec --classfiles /node/testData/clusterTestTemp/bamboo/${bamboo.shortPlanKey}/${bamboo.buildNumber}/CLASSFILES_NO_TESTS.jar --sourcefiles ModuleA/src/java:ModuleB/src/java:ModuleC/src/java --html reportsDir

When i then go to look at the report, I'm not seeing the source file, and indeed i'm getting the above (titled) error. Is this because I'm trying to include more than one source directory? Or is there something else at play here? Can I get a verbose output to see what is going wrong? 

Thank you in advance

Rafer

Marc Hoffmann

unread,
Jul 22, 2021, 12:07:22 AM7/22/21
to JaCoCo and EclEmma Users
Hi Rafer,

you can only specify one folder with the --sourcefiles option. But you can use this option multiple times. Please try the following:

--sourcefiles ModuleA/src/java --sourcefiles ModuleB/src/java --sourcefiles ModuleC/src/java

Best 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/bb741947-171c-4b3d-a45f-a9689fde654en%40googlegroups.com.

Rafer Gluyas

unread,
Jul 22, 2021, 12:15:19 AM7/22/21
to JaCoCo and EclEmma Users
Thank you Marc!

Abhay Hegde

unread,
Sep 22, 2021, 3:00:10 AM9/22/21
to JaCoCo and EclEmma Users
Hi Marc

if i provide the absolute path for the location of all *.java file, will it consider all the files present in that folder?

--sourcefiles /path/to/sourcefiles/ *.java

Regards
Abhay

Marc Hoffmann

unread,
Sep 22, 2021, 4:17:23 AM9/22/21
to JaCoCo and EclEmma Users
Unfortunatelly not, see FAQ (https://www.jacoco.org/jacoco/trunk/doc/faq.html):

Why does the coverage report not show highlighted source code?

Make sure the following prerequisites are fulfilled to get source code highlighting in JaCoCo coverage reports:

  • Class files must be compiled with debug information to contain line numbers.
  • Source files must be properly supplied at report generation time. I.e. specified source folders must be the direct parent of the folders that define the Java packages.



Reply all
Reply to author
Forward
0 new messages