Hello,
We have 3 questions. Our use case is we have several modules in a java 
project. Only one main service module is converted to classes and rest 
modules are converted to jar. For the module converted to classes its 
straight forward to get coverage but not for libs.
These questions are related to that - 

1) How to pass classes to Jacoco Agent when project is multi module? 
Excludes in Jacoco Agent only takes a list of classes. Then there are 
chance of collision if package name and Class name is same. How Jacoco 
agent will handle that? Also, do you have an example of passing classes 
from a multi module project?

2) Can we pass jar name also with inclusion/exclusions classes(like a map 
jar:[classes]) to jacoco Agent to exclude/include? This is to specify from 
this jar file exclude/include these classes.
The issue is we dont know which jar's classes are passed in JavaAgent. Our 
application can only list read list of classes from java Agent Config, no 
information about these classes belong to which jar originally.

3) When we are merging multiple Jaoco exec and each one has its own 
inclusion and exclusions. Then what would make more sense in generating 
reports? 
     a) union of inclusions and intersection of exclusions
     b) union of inclusions and union of exclusions


Regards
Mehul

On Thursday, 6 July 2023 at 12:18:33 UTC+5:30 Mehul Parmar wrote:

> Hello,
> We have 2 questions. Can you help on these - 
>
> 1) How to pass classes to Jacoco Agent when project is multi module? 
> Excludes in Jacoco Agent only takes a list of classes. Then there are 
> chance of collision if package name and Class name is same. How Jacoco 
> agent will handle that? Also, do you have an example of passing classes 
> from a multi module project?
>
> 2) How to pass jar to jacoco Agent to exclude/include or is it not allowed 
> and we need to extract jar to get all classes and then supply to jacoco 
> java agent.
>
> Thank you for answering previous questions. It helps a lot. 
>
> Regards
> Mehul
>
> On Tuesday, 4 July 2023 at 21:01:39 UTC+5:30 Evgeny Mandrikov wrote:
>
>>
>>
>> On Tue, 4 Jul 2023 at 17:24, Evgeny Mandrikov <mand...@gmail.com> wrote:
>>
>>> See 
>>> https://github.com/jacoco/jacoco/issues/34#issuecomment-10205525
>>>
>>
>> ie both slash (/) and dot (.) separated notations (VM and Java names) are 
>> accepted by agent
>>
>> while report Maven goal expects filenames
>>
>> <https://github.com/jacoco/jacoco/issues/34#issuecomment-10205525>
>>>
>> On Tue, 4 Jul 2023 at 08:07, Mehul Parmar <mehulpa...@gmail.com> wrote:
>>>
>>>> Hello,
>>>> Can you confirm this? Jacoco java agent accepts '.' naming convention
>>>> -javaagent:*[yourpath/]*jacocoagent.jar=excludes=*com.abc.package.**
>>>> -javaagent:*[yourpath/]*jacocoagent.jar=excludes=
>>>> *com.abc.package.ClassA*
>>>>
>>>> But java-maven-plugin and jacococli accepts '/' convention 
>>>>
>>>> <configuration>
>>>> <excludes>
>>>> <exclude>com/abc/ra/sample/init/*</exclude>
>>>> </excludes>
>>>> </configuration>
>>>>
>>>> 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 Sunday, 2 July 2023 at 15:11:06 UTC+5:30 Mehul Parmar wrote:
>>>>
>>>>> Hello, 
>>>>> Yes, I will get same coverage if I get an exec with all classes and 
>>>>> then filter in report or if I filter in exec itself(agent stage) and then 
>>>>> filter in report. But for big Java projects wanted to skip calculating 
>>>>> coverage and record in exec, so yes a little bit of performance 
>>>>> optimizations. 
>>>>> And yes, excluding package in prepare-agent goal worked! 
>>>>>
>>>>> On Sunday, 2 July 2023 at 13:17:32 UTC+5:30 Evgeny Mandrikov wrote:
>>>>>
>>>>>> how to explicit mention that exclude class(prepare-agent) and not 
>>>>>>> java files(report). 
>>>>>>>
>>>>>>>
>>>>>> Please refer to the Maven documentation about how to configure 
>>>>>> plugins - you can specify excludes in the configuration of the single 
>>>>>> goal 
>>>>>> prepare-agent, not for the entire plugin, ie
>>>>>>
>>>>>> <configuration>
>>>>>>   <!-- applies to all executions of all goals -->
>>>>>> </configuration>
>>>>>> <executions>
>>>>>>   <execution>
>>>>>>     <goals><goal>prepare-agent</goal></goals>
>>>>>>     <configuration>
>>>>>>       <!-- applies only for this execution of this goal -->
>>>>>>     </configuration>
>>>>>>
>>>>>>> -- 
>>>>>> 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.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/jacoco/68de79c7-5860-43a4-b083-fc4aaf85883an%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/jacoco/68de79c7-5860-43a4-b083-fc4aaf85883an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>>> Regards,
>>> Evgeny
>>>
>>> -- 
>> 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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/6504d89a-b15c-4cde-85a9-deed8d9f3154n%40googlegroups.com.

Reply via email to