Jacoco report in JUnit report output directory

Viewed 465

I have a simple Maven project configured to generate a JUnit report with the Surefire plugin, and a coverage report with Jacoco.

After running mvn test, I expect to find:

  1. jacoco report files in reports/jacoco
  2. surefire-report.html in reports/junit

However for some reason the Jacoco report files appear in both the reports/jacoco AND reports/junit folder:

enter image description here

Please help me to understand and correct.

pom.xml:

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>${surefire.plugin.version}</version>
                <configuration>
                    <outputDirectory>${basedir}/reports/junit</outputDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>during-tests</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.plugin.version}</version>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>INSTRUCTION</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.80</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/reports/jacoco</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            ...
0 Answers
Related