How to configure OpenJDK 11 in pom file.
<properties>
<maven.compiler.plugin.version>3.8.0</maven.compiler.plugin.version>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
</properties>
How to configure OpenJDK 11 in pom file.
<properties>
<maven.compiler.plugin.version>3.8.0</maven.compiler.plugin.version>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
</properties>
The problem is probably in the version of Java you're using to run Maven. See the discussion here:
Unable to compile simple Java 10 / Java 11 project with Maven
If you want to make Maven recognize a target release of 10 or 11, you have to first run Maven with Java 11. Check that the Java that Maven is using is correct by doing mvn --version
.
Here is a bit more advanced example that allows you to compile Java 11 while your main java version is 8. Most of my projects are still java 8 so I find it usefull.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk-11.0.2\bin\javac</executable>
</configuration>
</plugin>