Fork me on GitHub
#tools-deps
<
2020-05-05
>
murtaza5206:05:16

there was a strange bug, I had deleted my .m2 directory some time back, and when I started my nrepl, it would start, but then on compiling a file it would give an error of a missing dep. I changed the deps.edn file, and this triggered something, and on next nrepl startup, it downloaded the dependency. have never seen such a behaviour before.

Alex Miller (Clojure team)13:05:40

that all is what I would expect

Alex Miller (Clojure team)13:05:07

classpath is computed and then in cached in your .cpcache directory, with pointers into your .m2

Alex Miller (Clojure team)13:05:07

clj script doesn't re-check that those files still exist (it could do so, but there are some performance implications and it's a little messy)

Alex Miller (Clojure team)13:05:03

changing the deps.edn makes the cached cp stale (it checks that the cp file is newer than all the source deps.edn files)

Alex Miller (Clojure team)13:05:43

if you get into this situation again, use -Sforce to force the cp to be recomputed, which will also trigger a redownload

rogerio haruo adachi17:05:49

Hey, I'm running into some issues here, regarding transitive dependencies with deps with logging dependencies (cambium + unilog). Scenario is as follows: 1. I have a shared library that has common libs ( datomic in memory, datomic client, kafka, integrant ... and logging) 2. An application that imports the above shared library I have made all the necessary exclusions in item 1. But when I import in item 2, I got conflicts between slf4j many libraries that I have excluded in item 1. How can I maintain only dependencies required (with exclusions) in item 1 in a transitive way?

Alex Miller (Clojure team)18:05:56

can you share your dep.edn to repro?

rogerio haruo adachi19:05:43

this is my libs deps

:deps {org.clojure/clojure                       {:mvn/version "1.10.1"}
        fundingcircle/jackdaw                     {:mvn/version "0.6.9"
                                                   :exclusions [org.slf4j/slf4j-log4j12
                                                                commons-logging/commons-logging
                                                                log4j/log4j
                                                                org.slf4j/slf4j-nop
                                                                org.slf4j/log4j-over-slf4j
                                                                org.clojure/tools.logging]}
        datascript/datascript                     {:mvn/version "0.17.1"}
        willa                                     {:mvn/version "0.1.2"}
        com.cognitect/anomalies                   {:mvn/version "0.1.12"}
        com.gfredericks/test.chuck                {:mvn/version "0.2.10"}
        org.apache.kafka/kafka-streams            {:mvn/version "2.3.0"
                                                   :exclusions [org.slf4j/slf4j-api]}
        org.apache.kafka/kafka-streams-test-utils {:mvn/version "2.3.0"}
        io.pedestal/pedestal.service              {:mvn/version "0.5.7"}
        io.pedestal/pedestal.route                {:mvn/version "0.5.7"}
        io.pedestal/pedestal.jetty                {:mvn/version "0.5.7"}
        integrant                                 {:mvn/version "0.7.0"}
        integrant/repl                            {:mvn/version "0.3.1"}
        duct/core                                 {:mvn/version "0.8.0"}
        com.datomic/client-cloud                  {:mvn/version "0.8.78"
                                                   :exclusions [commons-logging/commons-logging]}
        com.cognitect.aws/api                     {:mvn/version "0.8.408"
                                                   :exclusions [org.clojure/tools.logging]}
        com.cognitect.aws/endpoints               {:mvn/version "1.1.11.689"}
        com.cognitect.aws/s3                      {:mvn/version "780.2.583.0"}
        rewrite-clj                               {:mvn/version "0.6.1"}
        compute/datomic-client-memdb
        {:git/url    ""
         :sha        "fd880e70b45a0837f1604aa1230047cb74ec536e"
         :exclusions [org.slf4j/slf4j-nop org.slf4j/log4j-over-slf4j org.slf4j/jcl-over-slf4j]}
        badigeon/badigeon
        {:git/url ""
         :sha     "dca97f9680a6ea204a2504c4414cafc4ba182a83"
         :exclusions [org.slf4j/slf4j-nop
                      org.slf4j/jcl-over-slf4j]}
        org.clojure/tools.cli                     {:mvn/version "0.4.2"}
        cambium/cambium.core                      {:mvn/version "0.9.3"}
        cambium/cambium.codec-simple              {:mvn/version "0.9.3"}
        spootnik/unilog                           {:mvn/version "0.7.24"}}

rogerio haruo adachi19:05:55

And this is my app Deps

:deps {org.clojure/clojure               {:mvn/version "1.10.1"}
        my.lib                           {:mvn/version "0.1.11-SNAPSHOT"}    ;; This is where I import my lib and get conflicts over slf4j log4j libs    
        tick                              {:mvn/version "0.4.20-alpha"}
        integrant/repl                    {:mvn/version "0.3.1"}
        com.gfredericks/test.chuck        {:mvn/version "0.2.10"}}

Alex Miller (Clojure team)19:05:28

are you sure you're actually getting the latest version of your snapshot lib? by default, maven will only refresh snapshots once per day

rogerio haruo adachi22:05:31

Yes, I have been working with the latest version of my lib (snapshot)

Alex Miller (Clojure team)20:05:37

what conflicts are you seeing?

Alex Miller (Clojure team)20:05:54

I see log4j-over-slf4j under spootnik/unilog and other slf4j stuff under cambium - you should look at clj -Stree and see if what you're getting makes sense

Alex Miller (Clojure team)20:05:51

if you want a more fine-grained analysis, use clj -Strace - that will generate a trace.edn file and you can walk through the :log to see each library it considers in order, whether it included it or not, and why

Alex Miller (Clojure team)20:05:27

as a fallback, including it as an explicit dep in your app deps will take precedence over anything below (none of those exclusions are necessary then)

rogerio haruo adachi22:05:49

Thanks @alexmiller the fallback choice might work for now. Mean while I have extracted logging dependencies into a separate library to avoid conflicts. Thanks for your help