Hi, is it possible to target specific clojure version during compilation? Basically I need jre7 compatible class versions.
I'm not sure I understand your question but you can add :java-opts to specify source and target versions:
(compile-clj {,,, :java-opts ["-source" "7" "-target" "7"]})
Maybe I'm not getting it right, but tools build minimum clojure requirement is 1.10, so 1.10 is compiles down to jre8 class version (52). To make classes compatible with 7 I've only option to use compiler from clojure 1.9
Yeah @armed, https://clojure.org/releases/downloads#_java_compatibility.
I'm afraid my only option is not to use tools.build in this case, just wanted to clarify
I'm curious, what is forcing you to remain compatible with java 7?
enterprise customer
With bunch of win-xp machines. JRE8 is available for XP, but they sticked to jre7
Sounds a bit challenging! I guess you just have to go back in tooling a bit in order to support obsolete tech. How's that song go? "I'm gonna program like it's 1999!" simple_smile
Yep, its my life whole 2023 year :)
I send you a lisp hug: lisphug
what matters here is the version of Clojure you compile with
@alexmiller is it possible with tools.build?
Clojure 1.9 was the last version to emit Java 6 bytecode (Clojure 1.10 switched to emit Java 8 bytecode)
because compilation happens in a forked process, I believe if you are using Clojure 1.9 or earlier in your basis, and Java 1.7 or earlier in your path, then the forked JVM for compile-clj should be emitting Java 6 bytecode
so, I think yes (have not tried it)
Ah ok, I tried that approach, failed with requiring-resolve not found. But I was running it from alias of deps.edn, I guess I need to run it externally
Thanks, Alex
ah, requiring-resolve was added in 1.10 I think. you could copy and alter the compile-clj task code to do something slightly different
oh, good point
well where is that coming from? tools.build itself?
you can run tools.build with a different Clojure version than your project basis
yes clojure.tools.build.api
Ok, then I still have a hope, I've a wrapper tool around tools build, didn't want to discard it completely.
yeah, in your :build alias, just add a :deps of org.clojure/clojure {:mvn/version "1.11.1"} but then in your project deps, use "1.9.0"