@@ -198,9 +198,45 @@ include::../../../../samples/java-application-with-tests/pom.xml[tag=native-plug
|
198 | 198 |
|
199 | 199 | Running `mvn -Pnative test` will then build and run native tests.
|
200 | 200 |
|
201 |
| -NOTE: This plugin requires JUnit Platform 1.8 or higher. |
| 201 | +[[testing-support-version-compatibility]] |
| 202 | +=== Version compatibility |
| 203 | + |
| 204 | +This plugin requires JUnit Platform 1.8 or higher and Maven Surefire 2.22.0 or higher to |
| 205 | +run tests within a native image. |
| 206 | + |
| 207 | +Each version of the Maven Surefire plugin has a dependency on a particular version of the |
| 208 | +JUnit Platform. You therefore need to ensure that Maven Surefire is using at least version |
| 209 | +1.8 of the JUnit Platform. Beginning with version 3.0 M4, Maven Surefire will |
| 210 | +automatically align the JUnit Platform version used by Surefire with the version needed by |
| 211 | +the user's configured version of JUnit Jupiter or JUnit Vintage. Since the examples in |
| 212 | +this document use Maven Surefire 3.0 M5, their maven POMs do not require any special |
| 213 | +configuration regarding the JUnit Platform version. However, if you are using a version of |
| 214 | +Maven Surefire prior to 3.0 M4 you will need to add an explicit dependency on the |
| 215 | +`junit-platform-launcher` artifact to the `dependencies` section of your `native` profile |
| 216 | +configuration as in the following example. |
202 | 217 |
|
203 |
| -NOTE: This plugin provides integration with Maven Surefire 2.22.0 or higher. |
| 218 | +[source,xml] |
| 219 | +---- |
| 220 | +<dependencies> |
| 221 | +<dependency> |
| 222 | +<groupId>org.junit.platform</groupId> |
| 223 | +<artifactId>junit-platform-launcher</artifactId> |
| 224 | +<version>1.8.2</version> |
| 225 | +<scope>test</scope> |
| 226 | +</dependency> |
| 227 | +</dependencies> |
| 228 | +---- |
| 229 | + |
| 230 | +TIP: If you have imported the `junit` BOM or are using a plugin that manages JUnit |
| 231 | +versions for you -- for example, Spring Boot -- you may want to omit the `<version>` |
| 232 | +configuration in the above example. |
| 233 | + |
| 234 | +If Maven Surefire is using an older version of the JUnit Platform, the build will fail |
| 235 | +with an error similar to the following when attempting to run tests in a native image. |
| 236 | + |
| 237 | +---- |
| 238 | +[ERROR] Test configuration file wasn't found. Make sure that test execution wasn't skipped. |
| 239 | +---- |
204 | 240 |
|
205 | 241 | [[testing-support-disabling]]
|
206 | 242 | === Disabling testing support
|
|
0 commit comments