What is the advantage of using --sourcefiles flag while generating jacoco reports using jacoco cli jar vs when not using it?
Reference: https://www.jacoco.org/jacoco/trunk/doc/cli.html
Task: Report
What is the advantage of using --sourcefiles flag while generating jacoco reports using jacoco cli jar vs when not using it?
Reference: https://www.jacoco.org/jacoco/trunk/doc/cli.html
Task: Report
To see the difference you can try with and without this option. For example:
Given following src/org/example/Example.java
package org.example;
class Example {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
After compilation and execution by
javac src/org/example/Example.java -d classes
java -javaagent:jacoco-0.8.5/lib/jacocoagent.jar -cp classes org.example.Example
Generation of report without --sourcefiles
java -jar jacoco-0.8.5/lib/jacococli.jar report jacoco.exec --classfiles classes --html report_without_sourcefiles
will produce report in directory report_without_sourcefiles
where you can not see source file
While generation of report with --sourcefiles
java -jar jacoco-0.8.5/lib/jacococli.jar report jacoco.exec --classfiles classes --sourcefiles src --html report_with_sourcefiles
will produce report in directory report_with_sourcefiles
where you can see source file