Hello Marc,
Thank you for confirming that both the appraoches will give same result. 
But in my analysis it was a little bit different. 
Step 1) I added some exclusions in jacoco-maven-plugin and ran the tests. I 
got an exec and report from the plugin which did not have those excluded 
classes at all in the report.
Step 2) When I used report command and selected all classes from target 
folder of project and jacoco.exec from previous step(generated by plugin), 
then somehow I got coverage of excluded classes as well in HTML report. How 
is that possible? The Jacoco.exec should not have coverage data of excluded 
classes.

1) Step 1
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
<configuration>
<excludes>
<exclude>com/abc/xyz/samples/init/**/*</exclude>
<exclude>com/abc/pqr/samples/impl/**/*</exclude>
</excludes>
</configuration>
<executions>

Step 2)
java -jar /Users/mehul/Downloads/org.jacoco.cli-0.8.10-nodeps.jar report 
/Users/mehul/Repos/mehul/abc/abcService/target/jacoco.exec --classfiles 
/Users/mehul/Repos/mehul/abc/abcService/target/classes --html ./report
On Thursday, June 29, 2023 at 1:51:57 PM UTC+5:30 Marc R. Hoffmann wrote:

> Hi Mehul,
>
> yes, this the correct approach: To set the scope of the report you filter 
> the classes at report stage.
>
> If you would filter at execution stage you would simply not collect data 
> for those classes but the classes will still show up in the report (as 
> uncovered).
>
> Regards,
> -marc
>
> On 28. Jun 2023, at 18:59, 'Mehul Parmar' via JaCoCo and EclEmma Users <
> jac...@googlegroups.com> wrote:
>
> Hello,
> For me these 2 above steps are generating the same results. Is it proper 
> thing to do to get exec file without any exclusions and then applying 
> everything at the report stage?
>
> On Wednesday, June 28, 2023 at 3:36:36 PM UTC+5:30 Mehul Parmar wrote:
>
>> Hello,
>> Thank you for confirming this. Also help with my frst doubt. Doing these 
>> two things create same coverage result ?
>>
>>
>> 1. Using jacoco-maven-plugin and excluding classes from config and then 
>> generating report - 
>> <groupId>org.jacoco</groupId>
>> <artifactId>jacoco-maven-plugin</artifactId>
>> <version>0.8.10</version>
>> <configuration>
>> <excludes>
>> <exclude>com/abc/xyz/samples/impl/**/*</exclude>
>> </excludes>
>> </configuration>
>>
>>
>> 2. Generating a Jacoco exec without any exclusion and then not including 
>> classFiles(com/abc/xyz/samples/impl/**/*) while generating report. 
>>
>>
>> On Wednesday, June 28, 2023 at 2:57:52 PM UTC+5:30 Evgeny Mandrikov wrote:
>>
>>> Also I created following ticket 
>>> https://github.com/jacoco/jacoco/issues/1490
>>>
>>> On Wednesday, June 28, 2023 at 11:03:07 AM UTC+2 Evgeny Mandrikov wrote:
>>>
>>>  
>>>
>>> On Tuesday, June 27, 2023 at 10:49:36 PM UTC+5:30 Mehul Parmar wrote:
>>>
>>> 2. Generating a Jacoco exec without any exclusion and then applying 
>>> exclusion from the command line. 
>>>
>>> java -jar /path/to/jacoco-cli.jar report jacoco.exec --classfiles 
>>> /path/to/classes --html /path/to/report --excludes='*'
>>>
>>> Also when I run the second command,  I noticed the exclusion is not 
>>> applying and I am getting the complete report as it is in jacoco.exec. Then 
>>> what is the point of giving exclusion in report command?
>>>
>>>
>>> As you can see in the documentation at 
>>> https://www.jacoco.org/jacoco/trunk/doc/cli.html
>>> and as well by executing
>>>
>>> java -jar /path/to/jacoco-cli.jar report
>>>
>>> The command line interface has no such parameter as "--excludes".
>>>
>>> To exclude something using the command line interface remove it from the 
>>> location specified by "--classfiles".
>>>
>>>
> -- 
> 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/6d2ff7a7-9aa8-47bb-99fe-a162f993532en%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jacoco/6d2ff7a7-9aa8-47bb-99fe-a162f993532en%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/f84561ba-c070-449e-bbb0-dff0682a23f9n%40googlegroups.com.

Reply via email to