I'm trying to create Java module project with Java-13 and Maven. My pom.xml
is:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>wtf.g4s8</groupId>
<artifactId>oot</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<junit-platform.version>5.3.1</junit-platform.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>13</jdk.version>
</properties>
<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-platform.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${jdk.version}</target>
<source>${jdk.version}</source>
<release>${jdk.version}</release>
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
</plugin>
</plugins>
</build>
</project>
versions:
$ mvn help:system | grep -i jdk
sun.boot.library.path=/opt/jdk-13.0.1/lib
jdk.debug=release
java.home=/opt/jdk-13.0.1
java.runtime.name=OpenJDK Runtime Environment
java.vm.name=OpenJDK 64-Bit Server VM
JDK_HOME=/opt/jdk-13.0.1
JAVA_HOME=/opt/jdk-13.0.1
JAVAC=/opt/jdk-13.0.1/bin/javac
$ mvn -version
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T22:00:29+03:00)
Maven home: /usr/share/maven-bin-3.6
Java version: 13.0.1, vendor: Oracle Corporation, runtime: /opt/jdk-13.0.1
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.3.2-gentoo", arch: "amd64", family: "unix"
It's working fine if I skip test phase with mvn clean package -DskipTests
:
BUILD SUCCESS
But when I'm trying to test the project with mvn clean test
, I'm getting error (full log with -e
is here: https://gist.github.com/g4s8/a08e88143b7b5ceec0e534a34b7ab734):
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project oot: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test failed: Unsupported class file major version 57 -> [Help 1]
It seems surefire plugin can't work with 13 JDK, but plugin docs says "Requirements: Maven 3.x and JDK 1.7 or higher" (JDK 13 is higher than JDK 1.7).
So did I configure something wrong in my pom.xml
or surefire plugin is not working with 13 JDK?
Example project to reproduce: https://github.com/g4s8/so58710751
mvn --version
showsOracle
java ...apart from that Maven/Maven Surefire is tested on JDK 8,11,12,13,14 builds.apache.org/view/M-R/view/Maven/job/maven-box/job/… – Orecticvendor Oracle
is OK, since maven points to correct JDK path/opt/jdk-13.0.1
and OpenJDK is Oracle's project, see openjdk.java.net – Bermudezsrc/main/java/<package>
and put themodule-info.java
intosrc/main/java
Apart from that I'm investigating this... – Orecticmodule-info.java
and the structure of your project. – Orectic