0

This is my folder structure:

- src
  - main
    - java
      - com.chintan.project
    - src-gen
      - com.chintan.project

Is there a way to exclude the classes of package com.chintan.project which are present in src-gen folder, from JaCoCo code coverage report.

The output/target directory of both the folders is same, and I cannot change the package structure or the way in which they are compiled and placed in the output/target directory.

I have tried the below JaCoCo configuration but its not working

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.11</version>
                <executions>
                    <execution>
                        <id>jacoco-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>**/src-gen/**/*</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>jacoco-report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>**/src-gen/**/*</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Can anyone let me know, where am I going wrong or what can be done to solve this problem.

2
  • 2
    If src-gen contents are generated code, those files shouldn't be inside the src folder. Ref stackoverflow.com/questions/22912900/… Commented Dec 11, 2024 at 9:36
  • Any generation of code should be targeted into target/...... Commented Dec 11, 2024 at 10:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.