tools-deps

2024-06-20T13:50:09.872339Z

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.1463

Alex Miller (Clojure team) 2024-06-20T16:55:08.627389Z

Can you explain what “seems to ignore” means? During install or when using the tool?

2024-06-20T17:02:03.960809Z

when using the tool

2024-06-20T17:04:24.348719Z

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 sec

2024-06-20T17:13:10.386329Z

deps.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.edn

Alex Miller (Clojure team) 2024-06-20T17:40:58.331729Z

This 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

2024-06-20T18:05:40.500179Z

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 ls

Alex Miller (Clojure team) 2024-06-20T18:27:42.261719Z

Tool invocation replaces all of the project deps with the tool deps

Alex Miller (Clojure team) 2024-06-20T18:27:56.614869Z

I think the alias is the only way to make that work atm

2024-06-20T18:49:56.464329Z

> 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

Alex Miller (Clojure team) 2024-06-20T22:11:35.778429Z

Correct, it doesn’t matter because the root deps is 1.11.3 and that is at the “top” and takes precedence

✔️ 1