Detected JDK Version: 18.0.1 is not in the allowed range [11.0,18.0)

I try to create a new binding by running

./ Rachio "Markus Michels" markus7017```

and the script aborts with

[INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (enforce-java) @ org.openhab.addons.reactor.bundles **---**
[WARNING**] Rule 0: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
Detected JDK Version: 18.0.1 is not in the allowed range [11.0,18.0).
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.076 s
[INFO] Finished at: 2022-07-17T19:22:32+02:00
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce **(enforce-java)** on project org.openhab.addons.reactor.bundles: **Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed.** -> **[Help 1]**

even Java/JDK 18 is not installed

ls -l /Library/Java/JavaVirtualMachines
total 0
drwxr-xr-x  3 root  wheel  96 18 Apr 19:46 zulu-11.jdk
drwxr-xr-x  3 root  wheel  96 19 Apr 08:11 zulu-8.jdk
java -version
openjdk version "" 2022-02-08 LTS
OpenJDK Runtime Environment Zulu11.54+25-CA (build
OpenJDK 64-Bit Server VM Zulu11.54+25-CA (build, mixed mode)
jenv versions
* 11 (set by /Users/markus/Dev/openhab-3/git/openhab-addons/bundles/.java-version)

Why does it detected JDK 1.18.1? How to fix this?

If you are under linux there might be a $JAVA_HOME coming into play. Depending on the distribution update-alternatives might not update it leading to situation where tools which rely on environment variable get crazy.

I am not using jenv. I know for sure maven doesn’t use it as well, so you have to find a way to link it over JAVA_HOME. I use for that purpose direnv which is more generic.