I downloaded open jdk and having some issues with maven build, specifically, maven-enforcer-plugin. Using plugin version 1.4.1.
Enforcer plugin is trying to enforce JDK version like
<requireJavaVersion>
<version>[13,)</version>
<message>[ERROR] OLD JDK [${java.version}] in use. Need JDK 13.0 or newer</message>
</requireJavaVersion>
Enforcer plugin crashes with following error
Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
at java.lang.String.checkBoundsBeginEnd (String.java:3319)
at java.lang.String.substring (String.java:1874)
at org.apache.commons.lang.SystemUtils.getJavaVersionAsFloat (SystemUtils.java:1122)
at org.apache.commons.lang.SystemUtils.<clinit> (SystemUtils.java:818)
at org.apache.maven.plugins.enforcer.RequireJavaVersion.execute (RequireJavaVersion.java:52)
at org.apache.maven.plugins.enforcer.EnforceMojo.execute (EnforceMojo.java:193)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
After spending lot of time, I finally figured out JDK is reporting version which does not have decimal point. This is causing the plugin to fail.
java -version
openjdk version "13" 2019-09-17
OpenJDK Runtime Environment (build 13+33)
OpenJDK 64-Bit Server VM (build 13+33, mixed mode, sharing)
What will be the workaround in this situation?