Maven Failsafe plugin - SurefireBooterForkException: There was an error in the forked process (TypeNotPresentExceptionProxy)
This GitHub issue - [#6254] Maven-failsafe-plugin fails to execute integration tests - and the related discussion helped me to solve my problem.
It's a bug. It turns out that newer Failsafe plugin versions (2.19.0 and later) don't work well with Spring Boot 1.4 (or later). Workaround is to downgrade the maven-failsafe-plugin to 2.18.1. Here's the updated pom.xml:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<!-- I don't specify version at all (Spring Boot can autoconfigure plugin version) -->
<executions>
<execution>
<!-- changed <id> to <phase>, but I don't know whether it's important or not. -->
<phase>integration-test</phase>
<!-- ... no changes here: the same as in the question ... -->
</execution>
</executions>
</plugin>
</plugins>
I followed the solution proposed here: https://github.com/spring-projects/spring-boot/issues/6254#issuecomment-307151464
Currently, I have failsafe plugin 2.22.0 and I'm able to use this version and not downgrade by explicitly configuring the classesDirectory
property:
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
Example:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
<configuration>
...
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
...
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
Another variant of the workaround is described later in the same Github issue thread: https://github.com/spring-projects/spring-boot/issues/6254#issuecomment-343470070
<classesDirectory>${project.build.directory}/${artifactId}.jar.original</classesDirectory>
Note (2020-02-27): maven-failsafe-plugin
version 3.0.0-M4 still needs these workarounds :-(