On Friday, March 15, 2019 at 9:16:22 AM UTC+1, [email protected] wrote: > > On Thursday, March 14, 2019 at 9:25:18 PM UTC+5:30, [email protected] > wrote: > > Hi Team , > > > > I'm doing the code coverage with jacoco plugin . I have multiple > projects and I'm able to generate single jacoco.exe but issue is I'm unable > to set the threshold value separately for each module . I wanted to set the > threshold value for each module. > > > > Here is my jacoco configuration. > > <groupId>org.jacoco</groupId> > > <artifactId>jacoco-maven-plugin</artifactId> > > <executions> > > <execution> > > <id>default-prepare-agent</id> > > <goals> > > <goal>prepare-agent</goal> > > </goals> > > </execution> > > <execution> > > <id>default-prepare-agent-integration</id> > > <goals> > > <goal>prepare-agent-integration</goal> > > </goals> > > </execution> > > <execution> > > <id>default-report</id> > > <goals> > > <goal>report</goal> > > </goals> > > </execution> > > <execution> > > <id>default-report-integration</id> > > <goals> > > <goal>report-integration</goal> > > </goals> > > </execution> > > <execution> > > <id>default-check</id> > > <goals> > > <goal>check</goal> > > </goals> > > <configuration> > > <haltOnFailure>true</haltOnFailure> > > <!-- the build will fail if any rule check fails --> > > <!-- > > * Check configuration used to specify rules on element types > (BUNDLE, > > * PACKAGE, CLASS, SOURCEFILE or METHOD) with a list of limits. > Each limit > > * applies to a certain counter (INSTRUCTION, LINE, BRANCH, > COMPLEXITY, > > * METHOD, CLASS) and defines a minimum or maximum for the > corresponding > > * value (TOTALCOUNT, COVEREDCOUNT, MISSEDCOUNT, COVEREDRATIO, > MISSEDRATIO). > > * If a limit refers to a ratio the range is from 0.0 to 1.0 > where the > > * number of decimal places will also determine the precision in > error > > * messages. A limit ratio may optionally be declared as a > percentage > > * where 0.80 and 80% represent the same value, the value must > end with %. > > --> > > <rules> > > <rule> > > <element>BUNDLE</element> > > <!-- <excludes> > > <exclude>*Test</exclude> > > </excludes> > > <limits> > > <limit> > > > <counter>INSTRUCTION</counter> > > > <value>COVEREDRATIO</value> > > > <minimum>.95</minimum> > > </limit> > > <limit> > > > <counter>BRANCH</counter> > > > <value>COVEREDRATIO</value> > > > <minimum>.95</minimum> > > </limit> > > </limits> --> > > </rule> > > <rule> > > <element>PACKAGE</element> > > </rule> > > <rule> > > <element>CLASS</element> > > </rule> > > <rule> > > <element>SOURCEFILE</element> > > </rule> > > <rule> > > <element>METHOD</element> > > </rule> > > </rules> > > </configuration> > > </execution> > > </executions> > > </plugin> > > <plugin> > > > > I have multiple projects and I wanted to give the different value for > each module. > > Please help on this . > > > > Thanks, > > Hi Team , > > Just to provide more information . > Let's take an example . > I have a project A , B ,C and all three having unit test cases and also I > have a project called "Integration-tests" where it will perform integration > tests for all three modules/projects (A,B,C) . now I have created a project > called "Code-coverage " in tha I'm able to generate aggregate report by > merging all jacococ.exec's generated in individual projects. Now I want to > perform Jacoco "check" with threshold values per module (let's say for A : > 0.9 , B:0.8 , C:0.7) in "Code-coverage" project but not in individual > project . > > Thanks, >
As was already said earlier ( https://groups.google.com/d/msg/jacoco/bgZUCIIsDP8/30N28YhwCwAJ ) as of today this is not possible with jacoco-maven-plugin , because *The "check" goal considers classes only of a single module for which it is executed.* If maven plugin is not flexible enough for your use case, please consider usage of JaCoCo Ant Tasks ( https://www.jacoco.org/jacoco/trunk/doc/ant.html ) , e.g. via maven-antrun-plugin -- 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/256b0df2-67ee-47fc-8b43-da73b03b13ef%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
