Fork me on GitHub

For general information about Maven Toolchains, see Guide to Using Toolchains

Using Maven Toolchains with Failsafe

By default, if the pom configures the toolchains plugin as specified in the aforementioned guide, Failsafe will launch the test jvm using the main toolchain configured in Maven.

In some cases, it may be desirable to compile and test using different jvms. While the jvm option can achieve this, it requires hardcoding system-specific paths. Configuration option jdkToolchain can be used to supply an alternate toolchain specification.

Configuring a different jvm for running tests using toolchains


The above example assumes that your `toolchains.xml` contains a valid entry with these values.

Minimum Java Version for Toolchains

The minimum version of Java that can be used as a toolchain is limited by the Surefire Booter requirement.

Surefire Version Minimum Java Version Class File Version
3.0.0-M6 or higher Java 8 52
3.0.0-M5 and lower Java 7 51
lower than 3.0.0-M1 Java 6 50

If you try to use a version older than the minimum supported version, you should face something like:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/surefire/booter/ForkedBooter: Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(
        at Method)
        at java.lang.ClassLoader.loadClass(
        at sun.misc.Launcher$AppClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(
        at sun.launcher.LauncherHelper.checkAndLoadMain(