This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-27
Channels
- # announcements (24)
- # babashka (26)
- # beginners (8)
- # calva (8)
- # clojure (78)
- # clojure-europe (1)
- # clojure-norway (22)
- # clojurescript (14)
- # datascript (5)
- # datomic (8)
- # fulcro (22)
- # helix (9)
- # humbleui (11)
- # malli (4)
- # off-topic (28)
- # pedestal (5)
- # reitit (10)
- # shadow-cljs (2)
- # tools-build (8)
- # tools-deps (9)
Hi, run into weird issue when trying to build a mixed clojure/java project into an uberjar. I've been looking at this for some time now and it is very possible that https://en.wikipedia.org/wiki/User_error#PEBKAC/PEBCAK/PICNIC.
$ java -version
openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment (Red_Hat-17.0.9.0.9-3) (build 17.0.9+9)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.9.0.9-3) (build 17.0.9+9, mixed mode, sharing)
$ clj --version
Clojure CLI version 1.11.1.1113
$ clj -T:build uber
Execution error (IllegalArgumentException) at com.sun.tools.javac.main.Arguments/reportDiag (Arguments.java:889).
error: release version 17 not supported
Full report at:
/tmp/clojure-6391560421448438714.edn
My deps.edn
contains
:build
{:deps {io.github.clojure/tools.build {:git/tag "v0.9.6" :git/sha "8e78bcc"}}
:ns-default build}
My build.clj
file looks like this
(ns build
(:require
[clojure.tools.build.api :as b]))
(def class-dir "target/classes")
(def jar-file "api.jar")
;; delay to defer side effects (artifact downloads)
(def basis (delay (b/create-basis {:project "deps.edn"})))
(defn clean [_]
(b/delete {:path "target"}))
(defn compile-java [_]
(b/javac {:src-dirs ["java"]
:class-dir class-dir
:basis @basis
:javac-opts ["--release" "17"]}))
(defn uber [_]
(clean nil)
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(compile-java nil)
(b/compile-clj {:basis @basis
:ns-compile '[carbonlink.api]
:class-dir class-dir})
(b/uber {:class-dir class-dir
:uber-file jar-file
:basis @basis
:main 'carbonlink.api.main}))
Running javac --help
tells the supported version
--release
Compile for the specified Java SE release. Supported releases: 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
Not really grasping where that javac
unsuppoerted version issue might stem from. Any help or pointers are welcome!I haven’t seen that before, does not at first glance make sense to me. The Java compilation happens in proc, so not sure how it could be any different than what you see reported in the Java version
Is there any chance this is JRE instead of JDK? Is that even still a thing?
If you remove the javac options, does it work?