Moving the original question from Clojurians Slack:
When moving one of my projects to JDK 19 I was pointing clojure to the jdk using the JAVA_CMD env var. Everything was fine til I hit the uber jar step in the CI, where it simply refused to recognise the jdk 19 functions.
Took me a while and including reading the tools.build source to realise why it wasn't propagating the JAVA_CMD var and turns out I had to read env and send the :java_cmd in the b/compile-clj call.
I can see why the behaviour is like this, but would :java_cmd defaulting to the value of JAVA_CMD something that could be considered? Feels a bit more intuitive for me, as mostly the invocations of tools.build fns would be from the shell.