Hi,

JaCoCo agent supports wild cards (* and ?). It does not support glob patterns 
(/**/). See documentation: https://www.jacoco.org/jacoco/trunk/doc/agent.html 
<https://www.jacoco.org/jacoco/trunk/doc/agent.html>

Also I wonder why you want to exclude these clesses from the agent, As 
documentation says: "Except for performance optimization or technical corner 
cases this option is normally not required."

Regards,
-marc



> On 30. Jun 2023, at 18:50, 'Mehul Parmar' via JaCoCo and EclEmma Users 
> <jacoco@googlegroups.com> wrote:
> 
> Hey Marc,
> Yes that worked. Thank you. I had to give explicit class name in 
> configuration. But how it will work when I have to exclude a package by using 
> wildcard characters (* and ?). If I just give 
> <exclude>com/abc/ra/samples/init/**/*</exclude> then how to explicit mention 
> that exclude class(prepare-agent) and not java files(report). 
> 
> <configuration>
>     <excludes>
>         <exclude>com/abc/ra/samples/impl/ClassA</exclude>
>         <exclude>com/abc/ra/samples/init/ClassB</exclude>
>     </excludes>
> </configuration>
> 
> On Friday, June 30, 2023 at 2:35:22 PM UTC+5:30 Marc R. Hoffmann wrote:
> Hi Mehul,
> 
> when you click in the “Sessions” link in the top right of the coverage report 
> you see a list of all classes in the the exec file
> 
> Also note that the “excudes” option for the prepare agent has a slightly 
> different format than the report “excludes” (class names vs. file names). 
> Please see documentation:
> 
> https://www.jacoco.org/jacoco/trunk/doc/prepare-agent-mojo.html#excludes 
> <https://www.jacoco.org/jacoco/trunk/doc/prepare-agent-mojo.html#excludes>
> https://www.jacoco.org/jacoco/trunk/doc/report-mojo.html#excludes 
> <https://www.jacoco.org/jacoco/trunk/doc/report-mojo.html#excludes>
> 
> 
> Cheery,
> -marc
> 
> 
>> On 30. Jun 2023, at 07:51, 'Mehul Parmar' via JaCoCo and EclEmma Users 
>> <jac...@googlegroups.com 
>> <applewebdata://81872BA9-62E2-4525-AD83-941195029F82>> wrote:
>> 
> 
>> Hello Marc,
>> Perhaps I was not clear. Yes in Step 2 report command I am passing all the 
>> class files, but in HTML report for excluded classes(in plugin) coverage 
>> should come as uncovered. Why? Because Jacoco.exec is generated from the 
>> plugin(Step 1) config which has the exclusions, so exec file should not have 
>> coverage data. So indeed classes will come in report as I am passing them in 
>> "--classfiles" but coverage should be uncovered. 
>> 
>> So it seems like 
>> Jacoco.exec(/Users/mehul/Repos/mehul/abc/abcService/target/jacoco.exec) 
>> generated from plugin with exclusions, has data of all classes which are 
>> excluded in configuration.  And when I check the report generated by plugin 
>> in Step 1, it does not have excluded classes at all in report which is 
>> expected. 
>> 
>> 
>> 
>> <plugin>
>>     <groupId>org.jacoco</groupId>
>>     <artifactId>jacoco-maven-plugin</artifactId>
>>     <version>0.8.10</version>
>>     <configuration>
>>         <excludes>
>>             <exclude>com/abc/ra/samples/init/**/*</exclude>
>>             <exclude>com/abc/ra/samples/impl/**/*</exclude>
>>         </excludes>
>>     </configuration>
>>     <executions>
>>         <!--first execution : for preparing JaCoCo runtime agent-->
>>         <execution>
>>             <id>prepare-agent</id>
>>             <goals>
>>                 <goal>prepare-agent</goal>
>>             </goals>
>>         </execution>
>>         <!--second execution : for creating code coverage reports-->
>>         <execution>
>>             <id>report</id>
>>             <phase>test</phase>
>>             <goals>
>>                 <goal>report</goal>
>>             </goals>
>>         </execution>
>>     </executions>
>> </plugin>
>> 
>> On Thursday, June 29, 2023 at 8:45:27 PM UTC+5:30 Evgeny Mandrikov wrote:
>> And earlier I tried to explain the same thing as Marc:
>> 
>> To exclude something using the command line interface remove it from the 
>> location specified by "--classfiles".
>> On Thu, 29 Jun 2023 at 17:12, Marc Hoffmann <hoff...@mountainminds.com <>> 
>> wrote:
>> Hi Mahul,
>> 
>> as I tried to explain: All *.class files you supply to the report command 
>> will show up in the report. The conten of the *.exec file does not define 
>> the scope of the report.
>> 
>> Regards,
>> -marc
>> 
>>> On 29. Jun 2023, at 16:06, 'Mehul Parmar' via JaCoCo and EclEmma Users 
>>> <jac...@googlegroups.com <>> wrote:
>>> 
>>> 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 
>>>> <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 
>>>> <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+un...@googlegroups.com <>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jacoco/f84561ba-c070-449e-bbb0-dff0682a23f9n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jacoco/f84561ba-c070-449e-bbb0-dff0682a23f9n%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+un...@googlegroups.com <>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jacoco/78D5F49D-5E18-4F9E-956A-646B2BA536CF%40mountainminds.com
>>  
>> <https://groups.google.com/d/msgid/jacoco/78D5F49D-5E18-4F9E-956A-646B2BA536CF%40mountainminds.com?utm_medium=email&utm_source=footer>.
>> -- 
>> Regards,
>> Evgeny
>> 
>> 
>> -- 
>> 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 
>> <applewebdata://81872BA9-62E2-4525-AD83-941195029F82>.
> 
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jacoco/8bbaa310-fa66-44f4-b660-1f46b95648c2n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jacoco/8bbaa310-fa66-44f4-b660-1f46b95648c2n%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 
> <mailto:jacoco+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/33d7f3fb-bca9-4bcd-b0ed-9cfcab015e04n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jacoco/33d7f3fb-bca9-4bcd-b0ed-9cfcab015e04n%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/3029A693-B788-4368-AECF-28A053AD08F8%40mountainminds.com.

Reply via email to