Hi,

the check goal works on the local project only. Unlike report-aggregate there 
is no corresponding goal that checks coverage on multiple projects.

But as you check coverage per “BUNDLE” (which is in case of Maven maven 
modules) you can add the check goal to the individual projects (or their parent 
pom). This will also give you the advantage that Maven fails on the specific 
projects which do not meet your criterial.

Regard,
-marc


> On 3. Jul 2019, at 19:13, [email protected] wrote:
> 
> Hi,
> 
> I'm not sure if I'm missing something or if this is a bug. I have managed to 
> create an aggregate report of my many modules and it is all working fine. 
> However, I wanted to add a check on this aggregate report to ensure the 
> overall coverage is at a minimum. This is the error that I'm getting:
> 
> [INFO] --- jacoco-maven-plugin:0.8.4:check (default-check) @ jacoco-report ---
> [INFO] Skipping JaCoCo execution due to missing classes 
> directory:<project_dir>/jacoco-report/target/classes
> 
> My project is laid out like so:
> 
> Root
> |--module1
> |--module2
> ...
> |--jacoco-report
> 
> Below is a snippet of the jacoco-report/pom.xml:
> 
>    <properties>
>        
> <code.coverage.project.folder>${basedir}/../</code.coverage.project.folder>
>    
> <code.coverage.overall.data.folder>${basedir}/../target/</code.coverage.overall.data.folder>
>    
> <code.coverage.overall.data.file>${code.coverage.overall.data.folder}/aggregate.exec</code.coverage.overall.data.file>
>    </properties>
> 
>    <dependencies>
>        <dependency>
>            <groupId>group_name</groupId>
>            <artifactId>module1</artifactId>
>            <version>1.0-SNAPSHOT</version>
>        </dependency>
>        ...
>    </dependencies>
> 
>    <build>
>        <plugins>
>            <plugin>
>                <groupId>org.jacoco</groupId>
>                <artifactId>jacoco-maven-plugin</artifactId>
>                <executions>
>                    <execution>
>                        <id>report-aggregate</id>
>                        <phase>verify</phase>
>                        <goals>
>                            <goal>report-aggregate</goal>
>                        </goals>
>                    </execution>
>                    <execution>
>                        <id>merge-results</id>
>                        <phase>verify</phase>
>                        <goals>
>                            <goal>merge</goal>
>                        </goals>
>                        <configuration>
>                            <fileSets>
>                                <fileSet>
>                                    
> <directory>${code.coverage.project.folder}</directory>
>                                    <includes>
>                                        
> <include>**/target/jacoco.exec</include>
>                                    </includes>
>                                </fileSet>
>                            </fileSets>
>                            
> <destFile>${code.coverage.overall.data.file}</destFile>
>                        </configuration>
>                    </execution>
>                    <execution>
>                        <id>default-check</id>
>                        <phase>verify</phase>
>                        <goals>
>                            <goal>check</goal>
>                        </goals>
>                        <configuration>
>                            
> <dataFile>${code.coverage.overall.data.file}</dataFile>
>                            <rules>
>                                <rule>
>                                    <element>BUNDLE</element>
>                                    <limits>
>                                        <limit>
>                                            <counter>COMPLEXITY</counter>
>                                            <value>COVEREDRATIO</value>
>                                            <minimum>50%</minimum>
>                                        </limit>
>                                    </limits>
>                                </rule>
>                            </rules>
>                        </configuration>
>                    </execution>
>                </executions>
>            </plugin>
>        </plugins>
>    </build>
> 
> Do I need to copy the class files into the jacoco-report/target/classes/ 
> directory? I assumed they would be copied over.
> 
> The report is correctly generated and I can click down to see various classes 
> and their coverage.
> 
> Thanks for your help!
> 
> -- 
> 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/77896053-37e9-4b33-bd4f-883d6039c96d%40googlegroups.com.

-- 
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/A3637011-359B-4491-828F-1884C26A2138%40mountainminds.com.

Reply via email to