From 76bf686fa596248f5ad5ffabcaeb073f542424e9 Mon Sep 17 00:00:00 2001 From: robert-smith-911 Date: Sun, 14 Mar 2021 22:08:07 -0400 Subject: [PATCH 1/5] [#25473] Add text to describe workarounds for using maven failsafe plugin when not using parent pom --- .../src/docs/asciidoc/using.adoc | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc index 330a076d8ba7..020f6ac23a69 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc @@ -105,6 +105,28 @@ For instance, to use a different version of the SLF4J library and the Spring Dat ---- +[[failsafe-plugin]] +=== Using Maven Failsafe Plugin without the Spring Boot Parent POM +If you are running integration tests with the https://maven.apache.org/surefire/maven-failsafe-plugin/[Maven Failsafe Plugin] while not using the Spring Boot Parent POM, you must be aware that as a default, the Spring Boot Parent POM configures https://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#classesDirectory[] to be `${project.build.outputDirectory}`. Without this default setting, Failsafe will put the repackaged application JAR on the classpath. To solve, configure a classifier for the repackaged jar. This allows Failsafe to use the original jar as follows: + +[source,xml,indent=0] +---- + + org.springframework.boot + spring-boot-maven-plugin + + exec + + +---- + +NOTE: When using JDK 11, Failsafe puts the repackaged application JAR on the module-path: ``. This also can cause a test failure when not using the Spring Boot Parent POM. To solve, you need to set `false` in the `useModulePath` to `false` in the `` section of the `maven-failsafe-plugin` as follows: + +[source,xml,indent=0] +---- + false +---- + [[using-overriding-command-line]] From f6b57cd8249c5409efc0ee343a1cbd4c9b2bd681 Mon Sep 17 00:00:00 2001 From: robert-smith-911 Date: Sun, 14 Mar 2021 22:31:46 -0400 Subject: [PATCH 2/5] [#25473] Correct typos, make verbiage easier to read Change NOTE to WARNING --- .../spring-boot-maven-plugin/src/docs/asciidoc/using.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc index 020f6ac23a69..3858e23edd81 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc @@ -120,7 +120,7 @@ If you are running integration tests with the https://maven.apache.org/surefire/ ---- -NOTE: When using JDK 11, Failsafe puts the repackaged application JAR on the module-path: ``. This also can cause a test failure when not using the Spring Boot Parent POM. To solve, you need to set `false` in the `useModulePath` to `false` in the `` section of the `maven-failsafe-plugin` as follows: +WARNING: When using JDK 11, Failsafe puts the repackaged application JAR on the module-path: ``. This also can cause a test failure when not using the Spring Boot Parent POM. To solve, set the `useModulePath` to `false` in the `` section of the `maven-failsafe-plugin` as follows: [source,xml,indent=0] ---- From a905722c2cd6827a11c41770094e27e6b7fd3438 Mon Sep 17 00:00:00 2001 From: robert-smith-911 Date: Sun, 14 Mar 2021 22:34:49 -0400 Subject: [PATCH 3/5] [#25473] Make verbiage easier to read --- .../spring-boot-maven-plugin/src/docs/asciidoc/using.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc index 3858e23edd81..af46dc4d8171 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc @@ -107,7 +107,7 @@ For instance, to use a different version of the SLF4J library and the Spring Dat [[failsafe-plugin]] === Using Maven Failsafe Plugin without the Spring Boot Parent POM -If you are running integration tests with the https://maven.apache.org/surefire/maven-failsafe-plugin/[Maven Failsafe Plugin] while not using the Spring Boot Parent POM, you must be aware that as a default, the Spring Boot Parent POM configures https://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#classesDirectory[] to be `${project.build.outputDirectory}`. Without this default setting, Failsafe will put the repackaged application JAR on the classpath. To solve, configure a classifier for the repackaged jar. This allows Failsafe to use the original jar as follows: +If you are running integration tests with the https://maven.apache.org/surefire/maven-failsafe-plugin/[Maven Failsafe Plugin] while not using the Spring Boot Parent POM, you must be aware that as a default, the Spring Boot Parent POM configures https://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#classesDirectory[] to be `${project.build.outputDirectory}`. Without this default setting, Failsafe will put the repackaged application JAR on the classpath, which can cause the integration tests to throw an `java.lang.IllegalStateException`. To solve, you must configure a classifier for the repackaged jar. This allows Failsafe to use the original jar as follows: [source,xml,indent=0] ---- @@ -120,7 +120,7 @@ If you are running integration tests with the https://maven.apache.org/surefire/ ---- -WARNING: When using JDK 11, Failsafe puts the repackaged application JAR on the module-path: ``. This also can cause a test failure when not using the Spring Boot Parent POM. To solve, set the `useModulePath` to `false` in the `` section of the `maven-failsafe-plugin` as follows: +WARNING: When using JDK 11, Failsafe puts the repackaged application JAR on the module-path: ``. This also can cause a test failure when not using the Spring Boot Parent POM. To solve, set the `useModulePath` property to `false` in the `` section of the `maven-failsafe-plugin` as follows: [source,xml,indent=0] ---- From f05eed1996595f2870c55c28cbd8403740d13d48 Mon Sep 17 00:00:00 2001 From: robert-smith-911 Date: Sun, 28 Mar 2021 22:58:57 -0400 Subject: [PATCH 4/5] Updated verbiage to clarify the spring boot parent pom default settings for Failsafe --- .../src/docs/asciidoc/using.adoc | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc index af46dc4d8171..e17710bf0a54 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc @@ -107,27 +107,20 @@ For instance, to use a different version of the SLF4J library and the Spring Dat [[failsafe-plugin]] === Using Maven Failsafe Plugin without the Spring Boot Parent POM -If you are running integration tests with the https://maven.apache.org/surefire/maven-failsafe-plugin/[Maven Failsafe Plugin] while not using the Spring Boot Parent POM, you must be aware that as a default, the Spring Boot Parent POM configures https://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#classesDirectory[] to be `${project.build.outputDirectory}`. Without this default setting, Failsafe will put the repackaged application JAR on the classpath, which can cause the integration tests to throw an `java.lang.IllegalStateException`. To solve, you must configure a classifier for the repackaged jar. This allows Failsafe to use the original jar as follows: +When using the Failsafe plugin, the Spring Boot Parent POM by default configures the to be ${project.build.outputDirectory}. +This configures Failsafe to use the compiled classes rather than the repackaged jar as such: [source,xml,indent=0] ---- - - org.springframework.boot - spring-boot-maven-plugin - - exec - - + + org.apache.maven.plugins + maven-failsafe-plugin + + ${project.build.outputDirectory} + + ---- -WARNING: When using JDK 11, Failsafe puts the repackaged application JAR on the module-path: ``. This also can cause a test failure when not using the Spring Boot Parent POM. To solve, set the `useModulePath` property to `false` in the `` section of the `maven-failsafe-plugin` as follows: - -[source,xml,indent=0] ----- - false ----- - - [[using-overriding-command-line]] === Overriding settings on the command-line From fe5128b5757a98b68fe873b6363065ddceb300d9 Mon Sep 17 00:00:00 2001 From: robert-smith-911 Date: Sun, 28 Mar 2021 23:02:46 -0400 Subject: [PATCH 5/5] Minor update to make verbiage easier to read. --- .../spring-boot-maven-plugin/src/docs/asciidoc/using.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc index e17710bf0a54..12148701d699 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc @@ -107,7 +107,7 @@ For instance, to use a different version of the SLF4J library and the Spring Dat [[failsafe-plugin]] === Using Maven Failsafe Plugin without the Spring Boot Parent POM -When using the Failsafe plugin, the Spring Boot Parent POM by default configures the to be ${project.build.outputDirectory}. +When using the Failsafe plugin, the Spring Boot Parent POM by default configures the `` to be `${project.build.outputDirectory}`. This configures Failsafe to use the compiled classes rather than the repackaged jar as such: [source,xml,indent=0]