Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NOTE: policy only have unit tests for sonar; if there are distincts tests for unit and integration and they generate different reports, adjust the plugin configuration accordingly.

Code Block
languagexml
<properties>
	.
	.
 	<jacoco.destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</jacoco.destFile>
	.
	.
</properties>

<plugins>
...
			<plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${version.jacoco}</version>
                <configuration>
                    <excludes>
                        <exclude>org/drools/**/*</exclude>
                        <exclude>**/gen/**</exclude>
                        <exclude>**/generated-sources/**</exclude>
                    </excludes>
                    <output>file</output>
                </configuration>
                <executions>
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>${jacoco.destFile}</destFile>
                            <append>true</append>
                            <propertyName>surefireArgLine</propertyName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${jacoco.destFile}</dataFile>
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report-aggregate</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report-aggregate</goal>
                        </goals>
                        <configuration>
                            <includeCurrentProject>true</includeCurrentProject>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
...
</plugins>

...