I am trying to run mvn test on my project. The project itself compiles and installs but man test fails with the following output:
[ERROR] Failed to execute g
Make sure your version of Maven runtime >= JRE 1.8.
Run java -version in console to check the version, if mvn command is executed in console too. Alternatively to change maven JRE in your IDE, if maven is executed in IDE.
UnsupportedClassVersionError:
Thrown when the Java Virtual Machine attempts to read a class file and determines that the major and minor version numbers in the file are not supported.
It seems I hadn't updated my Maven in Eclipse (right click project -> Maven -> Update Project...) or chosen JDK 8 in Window -> Preferences -> Java -> Compiler options. With these two done everything works perfectly again :)
The JVM shall be explicitly set in the plugin configuration.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<jvm>${env.JAVA_HOME}/bin/java</jvm>
</configuration>
</plugin>