Fork me on GitHub
#beginners
<
2022-05-31
>
kraf05:05:44

Hi, I hope this is the right place to ask this. I work with a Leiningen project and I wanted to try out https://github.com/nextjournal/clerk. It keeps complaining about missing dependencies (e.g. can't find tools.reader on the classpath which seems to be a transient dependency via edamame) when it's required and after a while I realized that it seems to work when used with tools.deps. Could anybody help me understand why it wouldn't work as a dependency in Leiningen and maybe how to get it working there? Currently it's not really an option to switch.

jumar06:05:46

What error exactly you get when you try to run it and what your dependency tree looks like? (lein deps :tree)

kraf08:05:40

The error is

user=>  (require '[nextjournal.clerk :as clerk])
Execution error (FileNotFoundException) at edamame.impl.parser/eval45481$loading (parser.cljc:1).
Could not locate clojure/tools/reader/impl/inspect__init.class, clojure/tools/reader/impl/inspect.clj or clojure/tools/reader/impl/inspect.cljc on classpath.
The output of lein deps :tree is massive and it won't grep easily. But thank you for the hint, there might actually be some conflict there. I found a line like this
Consider using these exclusions:
[io.github.nextjournal/clerk "0.7.418" :exclusions [log4j org.clojure/tools.reader]]
[vlaaad/reveal "1.3.273" :exclusions [log4j org.clojure/tools.reader]]
[com.layerware/hugsql "0.5.1" :exclusions [log4j org.clojure/tools.reader]]
Reveal works without issues though

kraf09:05:23

This is the output for clerk

[io.github.nextjournal/clerk "0.7.418" :exclusions [[log4j]]]
   [babashka/fs "0.1.3"]
   [borkdude/edamame "0.0.11"]
   [com.nextjournal/beholder "1.0.0"]
     [io.methvin/directory-watcher "0.15.0"]
       [net.java.dev.jna/jna "5.7.0"]
   [hiccup "2.0.0-alpha2"]
   [http-kit "2.5.3"]
   [io.github.nextjournal/markdown "0.3.69"]
     [applied-science/js-interop "0.2.6"]
       [appliedscience/js-interop "0.2.6-MOVED"]
     [org.graalvm.js/js-scriptengine "21.3.0"]
     [org.graalvm.js/js "21.3.0"]
       [com.ibm.icu/icu4j "69.1"]
       [org.graalvm.regex/regex "21.3.0"]
       [org.graalvm.sdk/graal-sdk "21.3.0"]
       [org.graalvm.truffle/truffle-api "21.3.0"]
   [lambdaisland/uri "1.11.86"]
   [mvxcvi/multihash "2.0.3"]
     [mvxcvi/alphabase "1.0.0"]
   [org.clojure/java.classpath "1.0.0"]
   [org.clojure/tools.analyzer.jvm "1.1.0"]
     [org.clojure/tools.analyzer "1.0.0"]
     [org.ow2.asm/asm "5.2"]
   [rewrite-clj "1.0.699-alpha"]
   [weavejester/dependency "0.2.1"]

jumar14:05:46

It looks like edamame is using tools.reader 1.3.4: https://github.com/borkdude/edamame/blob/master/project.clj#L12 But perhaps that exclude prevents tools.reader from being on the classpath - you can try lein classpath too.

kraf18:05:45

I had some wrong ideas about the dependencies in Clojure, I got it working now. Thanks a lot for your help!

Jon Olick18:05:47

clojure has no mutexes, correct?

Jon Olick18:05:26

ah ok, missed that

hiredman18:05:36

all java objects can be used as a lock, which is what locking uses

hiredman18:05:14

and clojure of course has full access to the java.util.concurrent.locks package

Ferdinand Beyer18:05:27

…and at the same time you should not need mutexes in everyday Clojure programming

emccue23:05:45

in a sense, clojure has more mutexes than you can even count