Fork me on GitHub
#tools-deps
<
2020-04-21
>
rberger07:04:28

What would the equivaliant to the function leiningen.core.main/abort be in a program started by clj tool? My googling for a solution has been unsuccessful.

dominicm07:04:54

I don't know the function, but I'd guess System/exit or throw based on the name.

dominicm07:04:01

What behavior do you want?

rberger07:04:29

I guess Print msg to standard err and exit with a value of 1. And propler terminate anything and supply proper messages... I did use System/exit for now. I’ve been translating software that use to use lein to use tools.deps toolchain and looking for things like this.

practicalli-john11:04:15

I have shared my user level ~/.clojure/deps.edn file, which includes aliases for all the common tools I use with Clojure projects. Instructions for using the aliases are in the README and in the relevant :alias sections. For some aliases that have optional arguments I have also created additional alias names to capture the most common options, to save the amount of details that need to be remembered. Any other useful aliases are most welcome and thanks to Sean Corfield for his collection of aliases. https://github.com/practicalli/clojure-deps-edn Thank you.

❤️ 4
seancorfield16:04:45

@jr0cket Is yours a superset of mine at this point, or is a selection of mine (plus your own additions)? Maybe I'll mine yours for extra stuff to add to mine 🙂

practicalli-john17:04:31

There is a substantial cross-over of libraries includes in the aliases. You have some I have not tested yet. I have some not included. There is some divergence in naming of aliases. Happy to work on convergence if there is interest / value.

8
🔥 4
jrwdunham19:04:47

Hi all. Looking for some help here. I'm using tools-deps and my deps.edn file has a :repl alias with an :override-deps that we can summarize as {tegere {:local/root "/path/to/tegere" :deps/manifest :deps}}. The problem seems to be that the transitive dependencies of my local deps are not present in my classpath. I can see by running clj -R:repl -Stree that I have a dependency path like tegere/tegere > com.cemerick/pomegranate 1.1.0 > org.apache.maven/maven-resolver-provider 3.5.3 > javax.inject/javax.inject 1. However, if I ls -l /root/.m2/repository/ I can see that my top-level :deps dependencies are present but the dependencies of my local [:repl :override-deps] (e.g., javax.inject, pomegranate) are not. Any advice? Thanks in advance.

Alex Miller (Clojure team)19:04:05

can you provide your clj version (`clj -Sdescribe`), a deps.edn to repro, and clj -Stree output?

jrwdunham19:04:15

bash-5.0# clj -Sdescribe
{:version "1.10.1.502"
 :config-files ["/usr/local/lib/clojure/deps.edn" "/root/.clojure/deps.edn" "deps.edn" ]
 :config-user "/root/.clojure/deps.edn"
 :config-project "deps.edn"
 :install-dir "/usr/local/lib/clojure"
 :config-dir "/root/.clojure"
 :cache-dir ".cpcache"
 :force false
 :repro false
 :resolve-aliases ""
 :classpath-aliases ""
 :jvm-aliases ""
 :main-aliases ""
 :all-aliases ""}

bash-5.0# cat deps.edn
{:deps
 {cheshire {:mvn/version "5.8.1"}
  clojure.java-time {:mvn/version "0.3.2"}
  clj-http {:mvn/version "3.10.0"}
  com.pubnub/pubnub-gson {:mvn/version "4.25.0"}
  com.taoensso/timbre {:mvn/version "4.10.0"}
  nrepl/nrepl {:mvn/version "0.6.0"}
  cider/cider-nrepl {:mvn/version "0.22.0"}
  hickory {:mvn/version "0.7.1"}
  org.clojure/tools.namespace {:mvn/version "1.0.0"}
  vbclient
  {:git/url "[email protected]:venuebook/vbclient.git"
   :sha "56f5e72bdf284a6430a6abeae2de9d96066f7f9d"}
  tegere
  {:git/url ""
  :sha "4dcac3c831ff08a4f746e852ffa759e9d49c3119"}}
 :aliases
 {:repl
  {:override-deps
   {vbclient
    {:local/root "/src/vbit/subs/vbclient"
     :deps/manifest :deps}
    tegere
    {:local/root "/src/vbit/subs/tegere"
     :deps/manifest :deps}}
   :main-opts
   ["-m" "nrepl.cmdline"
    "--middleware" "[cider.nrepl/cider-middleware]"
    "--port" "8050"
    "--bind" "0.0.0.0"]}}}

bash-5.0# clj -R:repl -Stree
org.clojure/clojure 1.10.1
  org.clojure/core.specs.alpha 0.2.44
  org.clojure/spec.alpha 0.2.176
org.clojure/tools.namespace 1.0.0
  org.clojure/java.classpath 1.0.0
  org.clojure/tools.reader 1.3.2
clj-http/clj-http 3.10.0
  commons-codec/commons-codec 1.12
  org.apache.httpcomponents/httpasyncclient 4.1.4
    org.apache.httpcomponents/httpcore-nio 4.4.10
  slingshot/slingshot 0.12.2
  commons-io/commons-io 2.6
  org.apache.httpcomponents/httpcore 4.4.11
  org.apache.httpcomponents/httpclient-cache 4.5.8
  org.apache.httpcomponents/httpclient 4.5.8
    commons-logging/commons-logging 1.2
  potemkin/potemkin 0.4.5
    riddley/riddley 0.1.12
  org.apache.httpcomponents/httpmime 4.5.8
vbclient/vbclient /src/vbit/subs/vbclient
  buddy/buddy-core 1.6.0
    org.bouncycastle/bcprov-jdk15on 1.62
    org.bouncycastle/bcpkix-jdk15on 1.62
    net.i2p.crypto/eddsa 0.3.0
  buddy/buddy-sign 3.1.0
com.pubnub/pubnub-gson 4.25.0
  com.squareup.retrofit2/converter-gson 2.4.0
  com.squareup.okhttp3/logging-interceptor 3.12.1
    com.squareup.okhttp3/okhttp 3.12.1
      com.squareup.okio/okio 1.15.0
  com.squareup.retrofit2/retrofit 2.5.0
  org.slf4j/slf4j-api 1.7.25
  com.google.code.gson/gson 2.8.5
clojure.java-time/clojure.java-time 0.3.2
  clj-tuple/clj-tuple 0.2.2
com.taoensso/timbre 4.10.0
  com.taoensso/encore 2.91.0
    com.taoensso/truss 1.5.0
  io.aviso/pretty 0.1.33
cider/cider-nrepl 0.22.0
hickory/hickory 0.7.1
  org.clojure/clojurescript 1.9.293
    org.clojure/data.json 0.2.6
    org.clojure/google-closure-library 0.0-20160609-f42b4a24
      org.clojure/google-closure-library-third-party 0.0-20160609-f42b4a24
    org.mozilla/rhino 1.7R5
    com.google.javascript/closure-compiler-unshaded v20160911
      com.google.jsinterop/jsinterop-annotations 1.0.0
      com.google.javascript/closure-compiler-externs v20160911
      args4j/args4j 2.0.26
      com.google.protobuf/protobuf-java 2.5.0
      com.google.code.findbugs/jsr305 1.3.9
  viebel/codox-klipse-theme 0.0.1
  quoin/quoin 0.1.2
  org.jsoup/jsoup 1.9.2
cheshire/cheshire 5.8.1
  com.fasterxml.jackson.dataformat/jackson-dataformat-cbor 2.9.6
  com.fasterxml.jackson.core/jackson-core 2.9.6
  tigris/tigris 0.1.1
  com.fasterxml.jackson.dataformat/jackson-dataformat-smile 2.9.6
nrepl/nrepl 0.6.0
tegere/tegere /src/vbit/subs/tegere
  instaparse/instaparse 1.4.10
  com.cemerick/pomegranate 1.1.0
    org.apache.maven.resolver/maven-resolver-transport-wagon 1.0.3
    org.apache.maven.wagon/wagon-provider-api 3.0.0
    org.apache.maven.resolver/maven-resolver-transport-http 1.0.3
    org.apache.maven.resolver/maven-resolver-transport-file 1.0.3
    org.apache.maven/maven-resolver-provider 3.5.3
      javax.inject/javax.inject 1
      org.apache.commons/commons-lang3 3.5
      org.apache.maven/maven-model-builder 3.5.3
        org.codehaus.plexus/plexus-component-annotations 1.7.1
        com.google.guava/guava 20.0
        org.codehaus.plexus/plexus-interpolation 1.24
        org.apache.maven/maven-builder-support 3.5.3
        org.apache.maven/maven-artifact 3.5.3
      org.codehaus.plexus/plexus-utils 3.1.0
      org.apache.maven.resolver/maven-resolver-api 1.1.1
      org.apache.maven.resolver/maven-resolver-spi 1.1.1
      org.apache.maven.resolver/maven-resolver-impl 1.1.1
      org.apache.maven/maven-model 3.5.3
      org.apache.maven.resolver/maven-resolver-util 1.1.1
      org.apache.maven/maven-repository-metadata 3.5.3
    org.apache.maven.wagon/wagon-http 3.0.0
      org.slf4j/jcl-over-slf4j 1.7.22
      org.apache.maven.wagon/wagon-http-shared 3.0.0
    org.tcrawley/dynapath 1.0.0
    org.apache.maven.resolver/maven-resolver-connector-basic 1.0.3
  me.raynes/fs 1.4.6
    org.apache.commons/commons-compress 1.8
      org.tukaani/xz 1.5

Alex Miller (Clojure team)20:04:52

and clj -Spath doesn't include pomegranate and javax.inject?

Alex Miller (Clojure team)20:04:08

oh, did you try -Sforce to force re-create your classpath?

Alex Miller (Clojure team)20:04:43

changes in local deps' deps.edn files do not trigger a classpath cache refresh so you might be seeing something old there

jrwdunham20:04:51

Those deps are present when I run clj -Spath

jrwdunham20:04:55

$ clj -R:repl -Spath
src:/root/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:...

jrwdunham20:04:26

but there is nothing at those locations on disk

jrwdunham20:04:49

bash-5.0# ls /root/.m2/repository/javax
ls: /root/.m2/repository/javax: No such file or directory

jrwdunham20:04:00

Odd, if I run clj -R:repl -Sforce -Stree then it seems to work...

jrwdunham20:04:55

bash-5.0# ls /root/.m2/repository/javax
inject

jrwdunham20:04:42

thing is, I'm trying to build a Docker image, and having the following RUN statements in my Dockerfile is not having the same effect:

RUN clj -R:repl -Sforce -Stree
RUN clj -R:repl -Sforce -Stree

jrwdunham21:04:57

Well, after removing the .cpcache/ dirs on my host machine and ensuring I have a Docker COPY that ensures my local :override-deps paths are available at build time (d'oh!), and running a Docker build with --no-cache, all seems to be working as expected.

jrwdunham21:04:58

Thanks for your help @U064X3EF3 (even if the issue seems ultimately to have been my Docker misconfiguration)—I at least learned more about how to use tools-deps, and maybe this will help somebody else.

Alex Miller (Clojure team)21:04:09

if you have a cached classpath, it does not currently verify that the dirs/files on the classpath actually exist, so manual mucking with ~/.m2 (either by the filesystem or your container config) can lead to some confusing results. -Sforce will usually help you there

Alex Miller (Clojure team)21:04:00

it's a little tricky to implement this check as it would need to be in the bash script

Alex Miller (Clojure team)21:04:20

and it requires some interpretation b/c missing path dirs is fine and pretty common