Fork me on GitHub
#tools-deps
<
2018-12-17
>
martinklepsch23:12:34

When passing some serialized EDN to clj is that when people use commas instead of spaces to get it regarded as a single argument?

martinklepsch23:12:52

clj -m some.ns '{:my "data"}'

dominicm23:12:27

Yeah. But not for the above case.

dominicm23:12:35

It's inside of deps.edn files.

aaelony23:12:04

Hi - longtime leiningen user here. I’m on a mac, I am using home brew, but the clj that gets installed stacktraces miserably

aaelony23:12:32

Here is the stacktrace:

$ clj -Sdescribe
Error building classpath. EOF while reading
java.lang.RuntimeException: EOF while reading
	at clojure.lang.Util.runtimeException(Util.java:221)
	at clojure.lang.EdnReader.readDelimitedList(EdnReader.java:746)
	at clojure.lang.EdnReader$MapReader.invoke(EdnReader.java:680)
	at clojure.lang.EdnReader.read(EdnReader.java:145)
	at clojure.lang.EdnReader.read(EdnReader.java:111)
	at clojure.edn$read.invokeStatic(edn.clj:35)
	at clojure.edn$read.invoke(edn.clj:14)
	at $slurp_edn.invokeStatic(io.clj:29)
	at $slurp_edn.invoke(io.clj:22)
	at clojure.tools.deps.alpha.reader$slurp_edn_map.invokeStatic(reader.clj:38)
	at clojure.tools.deps.alpha.reader$slurp_edn_map.invoke(reader.clj:35)
	at clojure.tools.deps.alpha.reader$slurp_deps.invokeStatic(reader.clj:58)
	at clojure.tools.deps.alpha.reader$slurp_deps.invoke(reader.clj:54)
	at clojure.core$map$fn__5587.invoke(core.clj:2745)
	at clojure.lang.LazySeq.sval(LazySeq.java:40)
	at clojure.lang.LazySeq.seq(LazySeq.java:49)
	at clojure.lang.Cons.next(Cons.java:39)
	at clojure.lang.RT.boundedLength(RT.java:1785)
	at clojure.lang.RestFn.applyTo(RestFn.java:130)
	at clojure.core$apply.invokeStatic(core.clj:659)
	at clojure.core$apply.invoke(core.clj:652)
	at clojure.tools.deps.alpha.reader$merge_deps.invokeStatic(reader.clj:73)
	at clojure.tools.deps.alpha.reader$merge_deps.invoke(reader.clj:70)
	at clojure.tools.deps.alpha.reader$read_deps.invokeStatic(reader.clj:78)
	at clojure.tools.deps.alpha.reader$read_deps.invoke(reader.clj:75)
	at clojure.tools.deps.alpha.script.make_classpath$combine_deps_files.invokeStatic(make_classpath.clj:47)
	at clojure.tools.deps.alpha.script.make_classpath$combine_deps_files.invoke(make_classpath.clj:43)
	at clojure.tools.deps.alpha.script.make_classpath$run.invokeStatic(make_classpath.clj:68)
	at clojure.tools.deps.alpha.script.make_classpath$run.invoke(make_classpath.clj:64)
	at clojure.tools.deps.alpha.script.make_classpath$_main.invokeStatic(make_classpath.clj:109)
	at clojure.tools.deps.alpha.script.make_classpath$_main.doInvoke(make_classpath.clj:84)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:702)
	at clojure.core$apply.invokeStatic(core.clj:657)
	at clojure.main$main_opt.invokeStatic(main.clj:317)
	at clojure.main$main_opt.invoke(main.clj:313)
	at clojure.main$main.invokeStatic(main.clj:424)
	at clojure.main$main.doInvoke(main.clj:387)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:702)
	at clojure.main.main(main.java:37)

aaelony23:12:45

any ideas welcome

aaelony23:12:55

(or I’ll go back to leiningen

seancorfield23:12:21

What does cat ~/.clojure/deps.edn show?

dpsutton23:12:55

when i run clj -Sdescribe it gives me some output that includes config-files ["/usr/local/lib/clojure/deps.edn" "/home/dan/.clojure/deps.edn" ]. There are some deps.edn files and it seems like one of these is broken. can you check your equivalent ones

aaelony23:12:57

That’s likely the culprit…

$ cat ~/.clojure/deps.edn
;; The deps.edn file describes the information needed to build a classpath.
;;
;; When using the `clojure` or `clj` script, there are several deps.edn files
;; that are combined:
;; - install-level
;; - user level (this file)
;; - project level (current directory when invoked)
;;
;; For all attributes other than :paths, these config files are merged left to right.
;; Only the last :paths is kept and others are dropped.

{
 {:aliases
 {:new {:extra-deps {seancorfield/clj-new
                     {:mvn/version "0.5.5"}}
        :main-opts ["-m" "clj-new.create"]}
  }

  ;; Paths
  ;;   Directories in the current project to include in the classpath

  ;; :paths ["src"]

  ;; External dependencies

  ;; :deps {
  ;;   org.clojure/clojure {:mvn/version "1.9.0"}
  ;; }

  ;; Aliases
	;;   resolve-deps aliases (-R) affect dependency resolution, options:
	;;     :extra-deps - specifies extra deps to add to :deps
	;;     :override-deps - specifies a coordinate to use instead of that in :deps
	;;     :default-deps - specifies a coordinate to use for a lib if one isn't found
	;;   make-classpath aliases (-C) affect the classpath generation, options:
	;;     :extra-paths - vector of additional paths to add to the classpath
	;;     :classpath-overrides - map of lib to path that overrides the result of resolving deps

  ;; :aliases {
  ;;   :deps {:extra-deps {org.clojure/tools.deps.alpha {:mvn/version "0.5.460"}}}
  ;;   :test {:extra-paths ["test"]}
  ;; }

  ;; Provider attributes

  ;; :mvn/repos {
  ;;   "central" {:url ""}
  ;;   "clojars" {:url ""}
  ;; }
} 

hiredman23:12:14

what does clojure -Srepro -Sdescribe show?

dpsutton23:12:26

it looks like aliases is malformed

dpsutton23:12:44

@hiredman s/he can't get any output due to this being unbalanced

seancorfield23:12:54

That's where your EOF is coming from @aaelony -- you're missing a }

hiredman23:12:34

@dpsutton right, clojure -Sdescribe would error if either the system or user level deps.edn had a problem, clojure -Srepro -Sdescribe would error if it was the system level

aaelony23:12:37

Can I nuke the ~/.clojure/deps.edn and try again?

seancorfield23:12:51

{:aliases
 {:new {:extra-deps {seancorfield/clj-new
                     {:mvn/version "0.5.5"}} ; NEED EXTRA } HERE
        :main-opts ["-m" "clj-new.create"]}
  }

👍 4
dpsutton23:12:53

ah thanks for explaining @hiredman

aaelony23:12:53

got it - that is now fixed

aaelony23:12:54

thanks

💯 4
aaelony23:12:12

yay - all set now… phfew.

aaelony23:12:17

big thanks all around

seancorfield23:12:45

Happy to help! At work we drive everything with clojure CLI -- we started with Leiningen back in 2011, switched to Boot at the end of 2015, and switched completely to the new CLI stuff this year.

aaelony23:12:33

Great - I’ve been mostly using R for the past year++ and getting back into Clojure and updating my toolset from lein

seancorfield23:12:33

Cool. And you can get started with Clojure 1.10 since the "gold" release of that dropped today which greatly improves error reporting in a lot of cases!

aaelony23:12:22

yeah - ironically, I didn’t feel the error reporting pain (until just now). The clj tool is still on 1.9 until it gets released to home brew.

Alex Miller (Clojure team)23:12:52

This particular error isn’t going to be any different with 1.10 afaik

aaelony23:12:24

for me, this was a “not knowing what you don’t know” kind of error

Alex Miller (Clojure team)23:12:48

The error reporting differences are primarily in the repl and this is just throwing an exception out of the main

aaelony23:12:25

perhaps if there was a spec check on the ~/.clojure/deps.edn file

Alex Miller (Clojure team)23:12:34

It would probably be reasonable to better trap around config file reading and give a better semantic error here

Alex Miller (Clojure team)23:12:00

Well, we’ve been supporting back to Clojure 1.8 in tools.deps, which is pre spec

Alex Miller (Clojure team)23:12:10

I will probably bump that up soon

Alex Miller (Clojure team)23:12:32

But in this case, it didn’t even read so would never be able to do a spec check anyhow

aaelony23:12:38

Though I read about it in the docs, I was pretty much unaware that the ~/.clojure/deps.edn file was involved