|
20 | 20 | <maven.compiler.target>${java.version}</maven.compiler.target> |
21 | 21 | <junit-jupiter.version>5.10.2</junit-jupiter.version> |
22 | 22 | <xray-junit-extensions.version>0.7.3</xray-junit-extensions.version> |
23 | | - <xray-maven-plugin.version>0.7.4</xray-maven-plugin.version> |
| 23 | + <xray-maven-plugin.version>0.8.0</xray-maven-plugin.version> |
| 24 | + <maven-failsafe-plugin.version>3.2.5</maven-failsafe-plugin.version> |
| 25 | + <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version> |
| 26 | + <jacoco.version>0.8.13</jacoco.version> |
| 27 | + <unit.coverage.file>${project.build.directory}/jacoco-output/jacoco-unit-tests.exec</unit.coverage.file> |
| 28 | + <it.coverage.file>${project.build.directory}/jacoco-output/jacoco-it-tests.exec</it.coverage.file> |
| 29 | + <merged.coverage.file>${project.build.directory}/jacoco-output/merged.exec</merged.coverage.file> |
| 30 | + <jacoco.maven.opts>-javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=${it.coverage.file},append=true</jacoco.maven.opts> |
24 | 31 | </properties> |
25 | 32 | <dependencies> |
26 | 33 | <dependency> |
|
93 | 100 |
|
94 | 101 | <build> |
95 | 102 | <plugins> |
| 103 | + |
| 104 | + <!-- Jacoco runner to inspect code coverage --> |
| 105 | + <plugin> |
| 106 | + <groupId>org.jacoco</groupId> |
| 107 | + <artifactId>jacoco-maven-plugin</artifactId> |
| 108 | + <version>${jacoco.version}</version> |
| 109 | + |
| 110 | + <executions> |
| 111 | + <execution> |
| 112 | + <id>before-unit-test-execution</id> |
| 113 | + <goals> |
| 114 | + <goal>prepare-agent</goal> |
| 115 | + </goals> |
| 116 | + <configuration> |
| 117 | + <destFile>${unit.coverage.file}</destFile> |
| 118 | + <propertyName>surefire.jacoco.args</propertyName> |
| 119 | + </configuration> |
| 120 | + </execution> |
| 121 | + <execution> |
| 122 | + <id>after-unit-test-execution</id> |
| 123 | + <phase>test</phase> |
| 124 | + <goals> |
| 125 | + <goal>report</goal> |
| 126 | + </goals> |
| 127 | + <configuration> |
| 128 | + <dataFile>${unit.coverage.file}</dataFile> |
| 129 | + <outputDirectory>${project.reporting.outputDirectory}/jacoco-unit-test-coverage-report</outputDirectory> |
| 130 | + </configuration> |
| 131 | + </execution> |
| 132 | + |
| 133 | + <execution> |
| 134 | + <id>before-integration-test-execution</id> |
| 135 | + <phase>pre-integration-test</phase> |
| 136 | + <goals> |
| 137 | + <goal>prepare-agent-integration</goal> |
| 138 | + </goals> |
| 139 | + <configuration> |
| 140 | + <destFile>${it.coverage.file}</destFile> |
| 141 | + <propertyName>failsafe.jacoco.args</propertyName> |
| 142 | + <classDumpDir>${project.build.directory}/jacoco-dump</classDumpDir> |
| 143 | + <append>true</append> |
| 144 | + </configuration> |
| 145 | + </execution> |
| 146 | + <execution> |
| 147 | + <id>after-integration-test-execution</id> |
| 148 | + <phase>post-integration-test</phase> |
| 149 | + <goals> |
| 150 | + <goal>report</goal> |
| 151 | + </goals> |
| 152 | + <configuration> |
| 153 | + <dataFile>${it.coverage.file}</dataFile> |
| 154 | + <outputDirectory>${project.reporting.outputDirectory}/jacoco-it-coverage-report</outputDirectory> |
| 155 | + </configuration> |
| 156 | + </execution> |
| 157 | + |
| 158 | + <execution> |
| 159 | + <id>merge-unit-and-integration</id> |
| 160 | + <phase>post-integration-test</phase> |
| 161 | + <goals> |
| 162 | + <goal>merge</goal> |
| 163 | + </goals> |
| 164 | + <configuration> |
| 165 | + <fileSets> |
| 166 | + <fileSet> |
| 167 | + <directory>${project.build.directory}/jacoco-output/</directory> |
| 168 | + <includes> |
| 169 | + <include>*.exec</include> |
| 170 | + </includes> |
| 171 | + </fileSet> |
| 172 | + </fileSets> |
| 173 | + <destFile>merged.coverage.file</destFile> |
| 174 | + </configuration> |
| 175 | + </execution> |
| 176 | + <execution> |
| 177 | + <id>create-merged-report</id> |
| 178 | + <phase>post-integration-test</phase> |
| 179 | + <goals> |
| 180 | + <goal>report</goal> |
| 181 | + </goals> |
| 182 | + <configuration> |
| 183 | + <dataFile>merged.coverage.file</dataFile> |
| 184 | + <outputDirectory>${project.reporting.outputDirectory}/jacoco-merged-test-coverage-report</outputDirectory> |
| 185 | + </configuration> |
| 186 | + </execution> |
| 187 | + |
| 188 | + </executions> |
| 189 | + </plugin> |
| 190 | + |
| 191 | + |
| 192 | + <plugin> |
| 193 | + <groupId>org.apache.maven.plugins</groupId> |
| 194 | + <artifactId>maven-surefire-plugin</artifactId> |
| 195 | + <version>${maven-surefire-plugin.version}</version> |
| 196 | + <configuration> |
| 197 | + <argLine>${surefire.jacoco.args}</argLine> |
| 198 | + <includes> |
| 199 | + <include>**/*Test.java</include> |
| 200 | + </includes> |
| 201 | + <excludes> |
| 202 | + <exclude>**/*IT.java</exclude> |
| 203 | + </excludes> |
| 204 | + |
| 205 | + <testFailureIgnore>false</testFailureIgnore> |
| 206 | + <disableXmlReport>true</disableXmlReport> |
| 207 | + <useFile>false</useFile> |
| 208 | + </configuration> |
| 209 | + </plugin> |
| 210 | + |
| 211 | + <plugin> |
| 212 | + <groupId>org.apache.maven.plugins</groupId> |
| 213 | + <artifactId>maven-failsafe-plugin</artifactId> |
| 214 | + <version>${maven-failsafe-plugin.version}</version> |
| 215 | + <configuration> |
| 216 | + <!-- |
| 217 | + check if the following ones are actually needed or not to run the integration tests |
| 218 | + --> |
| 219 | + <systemProperties> |
| 220 | + <maven.version>${maven.version}</maven.version> |
| 221 | + <maven.home>${maven.home}</maven.home> |
| 222 | + </systemProperties> |
| 223 | + |
| 224 | + <argLine>${failsafe.jacoco.args}</argLine> |
| 225 | + <includes> |
| 226 | + <include>**/*IT.java</include> |
| 227 | + </includes> |
| 228 | + <excludes> |
| 229 | + <exclude>**/*Test.java</exclude> |
| 230 | + </excludes> |
| 231 | + |
| 232 | + <!-- based on https://github.com/khmarbaise/maven-it-extension/discussions/328 , to be able to track coverage of IT tests --> |
| 233 | + <environmentVariables> |
| 234 | + <MAVEN_OPTS>${jacoco.maven.opts}</MAVEN_OPTS> |
| 235 | + </environmentVariables> |
| 236 | + |
| 237 | + <properties> |
| 238 | + <configurationParameters> |
| 239 | + <!-- |
| 240 | + these are the default values, but we want to make sure that they are not changed by the user |
| 241 | + https://maven.apache.org/surefire/maven-failsafe-plugin/examples/junit-platform.html |
| 242 | + --> |
| 243 | + junit.jupiter.execution.parallel.enabled = false |
| 244 | + junit.jupiter.execution.parallel.mode.default = same_thread |
| 245 | + junit.jupiter.execution.parallel.mode.classes.default = same_thread |
| 246 | + </configurationParameters> |
| 247 | + </properties> |
| 248 | + |
| 249 | + </configuration> |
| 250 | + <executions> |
| 251 | + <execution> |
| 252 | + <goals> |
| 253 | + <goal>integration-test</goal> |
| 254 | + <goal>verify</goal> |
| 255 | + </goals> |
| 256 | + </execution> |
| 257 | + </executions> |
| 258 | + </plugin> |
| 259 | + |
96 | 260 | <plugin> |
97 | 261 | <groupId>org.springframework.boot</groupId> |
98 | 262 | <artifactId>spring-boot-maven-plugin</artifactId> |
|
0 commit comments