Welcome! Please see the About page for a little more info on how this works.

0 votes
in REPL by

I want to check which version of some dependencies I have loaded in the project from the REPL. Can it be done? How do I do this, if so?

The project I am working with is started via a rather involved script, making it a bit hard to know what version of certain dependencies are eventually loaded. I am thinking that once I have a REPL, then I have the truth.

It's a tools.deps project

2 Answers

+1 vote
by
selected by
 
Best answer

You can check the runtime classpath with

(System/getProperty "java.class.path")
+1 vote
by

For a given namespace, you can get the full path to the resource it will be (or was) loaded from.

user=> (clojure.java.io/resource "clojure/core.clj")
#object[java.net.URL 0x59221b97 "jar:file:/home/justin/.m2/repository/org/clojure/clojure/1.10.1/clojure-1.10.1.jar!/clojure/core.clj"]

This will include the version of the package in the jar name (or else reveal the file path from which the code would be loaded).

by
I also use Alex's method shared in another answer, but sometimes this approach can reveal things that wouldn't be apparent otherwise, eg. a .clj or .class file that a library bundles accidentally / unexpectedly.
...