I'm trying to install and invoke a tool via
clj -Ttools install my/tools '{:local/root "/home/me/tools"}' :as mytool
clj -Tmytool myfn
But this seems to ignore the clojure dependency I have in my tool's deps.edn to use the latest beta org.clojure/clojure {:mvn/version "1.12.0-beta1"}. The other deps work fine. Is that expected? Is there some way around it? I'm using what I think is the latest CLI version.
Clojure CLI version 1.11.3.1463Can you explain what “seems to ignore” means? During install or when using the tool?
when using the tool
I'm basically just trying to (:require [clojure.java.process :as proc]) in the tools' ns-default, but getting
Could not locate clojure/java/process__init.class, clojure/java/process.clj or clojure/java/process.cljc on classpath.
when I invoke the tool. I can make a minimal repro in one secdeps.edn
{:deps {org.clojure/clojure {:mvn/version "1.12.0-beta1"}}
:tools/usage {:ns-default mytool}
src/mytool.clj
(ns mytool
;;(:require [clojure.java.process :as proc]) ;; same error
)
(defn clj-version [& {:as args}]
(println *clojure-version*))
(defn ls [& {:as args}]
@((requiring-resolve 'clojure.java.process/start)
{:in :inherit :out :inherit :err :inherit}
"ls"))
Installation
$ clojure -Ttools install me/mytool '{:local/root "/home/me/mytool"}' :as mytool
# (command works, but shows we're not using correct clojure version)
$ clojure -Tmytool clj-version
{:major 1, :minor 11, :incremental 3, :qualifier nil}
$ clj -Tmytool ls
Execution error (FileNotFoundException) at mytool/ls (mytool.clj:10).
Could not locate clojure/java/process__init.class, clojure/java/process.clj or clojure/java/process.cljc on classpath.
Full report at:
/tmp/clojure-15188167626340676610.ednThis is actually a known issue with tools (project deps are omitted so you end up with the root dep clojure version when invoking tools), I think
You mean just the project dep for clojure itself is omitted right? Since, for example, https://github.com/liquidz/antq seems to work using the tool name invocation it has some dependencies that to get downloaded on the first run. I'm guessing that the tool invocation works using something like add-libs but it can't replace the the dep for clojure itself that the cli process is using? (fwiw I did get it to work with an alias adding an alias to my invocation that adds the clojure dep. Just using the tool via its alias might be better though)
clojure -A:clj12beta1 -Tmytool lsTool invocation replaces all of the project deps with the tool deps
I think the alias is the only way to make that work atm
> I think the alias is the only way to make that work atm Got it > Tool invocation replaces all of the project deps with the tool deps Just to make sure I'm clear though, the correct dep (for clojure 1.12 beta1) IS in my tool's deps. By which I mean the deps.edn file for my tool that I installed does have the correct dep, but that seems not to be used when I invoke it
Correct, it doesn’t matter because the root deps is 1.11.3 and that is at the “top” and takes precedence