Dear Sameer, unfortunately we don’t have a check goal for aggregate reports.
A common work around is to use the JaCoCo Ant tasks <https://www.jacoco.org/jacoco/trunk/doc/ant.html> (which can be embedded in a Maven build). Unlike the Maven goals the Ant tasks do not make any assumptions about the project layout and can be manually configured according to your needs. Regards, -marc > On 29. Aug 2024, at 13:51, Sameer Kumar <[email protected]> wrote: > > I am looking for a solution to use jacoco:check in a multi module maven > project. > The requirement is to put a threshold of 80% coverage check on the entire > application instead of individual module. > > Right now, it fails the build even if the check for one module is not above > the threshold value. I have already created a separate > jacoco-aggregate-module where I am aggregating the multi module results. > > Configuration of jacoco in parent pom.xml: > <plugin> > <groupId>org.jacoco</groupId> > <artifactId>jacoco-maven-plugin</artifactId> > <version>${jacoco-maven-plugin.version}</version> > <executions> > <!-- Prepare the JaCoCo agent before tests run --> > <execution> > <id>prepare-agent</id> > <goals> > <goal>prepare-agent</goal> > </goals> > <phase>initialize</phase> > </execution> > </executions> > </plugin> > > Configuration of jacoco in jacoco-aggregate-module pom.xml: > <plugin> > <groupId>org.jacoco</groupId> > <artifactId>jacoco-maven-plugin</artifactId> > <version>${jacoco-maven-plugin.version}</version> > <executions> > <!-- Aggregate the report after tests run --> > <execution> > <id>report-aggregate</id> > <phase>verify</phase> > <goals> > <goal>report-aggregate</goal> > </goals> > <configuration> > <destFile>${project.basedir}/target/jacoco.exec</destFile> > > <outputDirectory>${project.basedir}/target/jacoco-reports</outputDirectory> > </configuration> > </execution> > <execution> > <id>default-check</id> > <phase>verify</phase> > <goals> > <goal>check</goal> > </goals> > <configuration> > <rules> > <rule>implementation="org.jacoco.maven.RuleConfiguration"> > <element>BUNDLE</element> > <limits> > <limit implementation="org.jacoco.report.check.Limit"> > <counter>LINE</counter> > <value>COVEREDRATIO</value> > <minimum>${cc.code-coverage-ratio}</minimum> > </limit> > </limits> > </rule> > </rules> > </configuration> > </execution> > </executions> > </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] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jacoco/9eaeccf9-a2f0-479d-a4a5-9242562b09acn%40googlegroups.com > > <https://groups.google.com/d/msgid/jacoco/9eaeccf9-a2f0-479d-a4a5-9242562b09acn%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/E18AEE3C-AF5E-45C2-82A6-C26C3FA6688D%40mountainminds.com.
