Hello Marc, We are running Jacoco in server mode in a GCP vm i.e. server mode. So our application(container) is running inside that vm along with Jacoco agent(second container). Our another application sends a dump request to that vm and get the Jacoco.exec and generates the report.
Regarding your answer 1) How will I send Jacoco config for each module to a single Jacoco Agent in a single request? Can you explain with an example? 2) Jacoco.exec would be merged that is not an issue. Issue is how to interpret exclusions and inclusions. We actually do multiple Test runs of a single application and merge them. In one TestRun I included let say class A,B,C and excluded C in second TestRun I class A, P, Q and excluded Q. Now when I merge them, in inclusion I will consider union of classes means A,B,C,P,Q but in exclusion what should make more sense? a) Union of exclusion - C,Q b) intersection of exclusions - NIL, so all classes are included in report. Regards mehul On Friday, 7 July 2023 at 19:26:57 UTC+5:30 Marc R. Hoffmann wrote: > Hi Mehul, > > I still don’t understand why you want to configure the exclusions for the > agent. Have you measured any differences in execution performance? I think > this adds needless complexity to your build. Regarding your questions: > > 1) If you really want you can provide a JaCoCo configuration separately > for every Maven modul > 2) No, only class names > 3) Just merge them > > Regards, > -marc > > > On 7. Jul 2023, at 14:10, Mehul Parmar <[email protected]> wrote: > > 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 <[email protected]> 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 <[email protected]> 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 [email protected]. >>>>> 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 [email protected]. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/jacoco/6504d89a-b15c-4cde-85a9-deed8d9f3154n%40googlegroups.com > > <https://groups.google.com/d/msgid/jacoco/6504d89a-b15c-4cde-85a9-deed8d9f3154n%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/0e533b51-23c1-4b01-abe9-5195be4c843fn%40googlegroups.com.
