Fork me on GitHub
#beginners
<
2022-01-11
>
zackteo03:01:24

Hello! Is there a way to install clojure cli without root access for mac? I was looking at https://clojure.org/guides/getting_started but doesn't seem to provide what i want. Is there a Clojure jar with depencies that i can download from maven? (The reason I don't have root access is that is my work laptop. We have a way to get lein downloaded and we have been using that but am trying to use deps.edn)

andy.fingerhut03:01:40

Do you have permission to install Homebrew, or is it already installed and you have permission to add new Homebrew packages/(whatever-Homebrew-calls-them)?

hiredman03:01:28

You can also check out the Linux version, which has a shell script it uses to install and can be given a prefix to install in

Alex Miller (Clojure team)03:01:59

^^ that's probably a better bet for this case, although it may need some slight modification to work on Mac (don't remember)

zackteo03:01:46

I don't have homebrew or permissions to install homebrew sadly 😕

zackteo03:01:07

I was looking at the Linux version and it seems I require sudo access?

zackteo03:01:32

hmm actually it looks like a simple script maybe i can modify it hmmm

Alex Miller (Clojure team)04:01:58

you can, it's nothing too fancy

zackteo05:01:42

Yeap I do need to change it a bit - mac, at least my version of mac doesn't have the -D flag on install. So need separate commands to create the folder paths mkdir -p , cp and chmod

zackteo06:01:44

does anyone happen to know how to install rlwrap like perhaps as a binary?

zackteo06:01:14

like a pkgs for mac :thinking_face:

Alex Miller (Clojure team)06:01:15

you don't technically need rlwrap

Alex Miller (Clojure team)06:01:35

it's just nice if you're using a repl from clj

zackteo07:01:34

So for commands that ask for clj i can run clojure instead?

Benjamin08:01:49

Can I put docstrings to specs somehow?

Alex Miller (Clojure team)13:01:16

No, this is I think the most requested feature of spec

clojure-spin 1
rmxm14:01:03

I am putting together small rest api (stateless). First checked the luminus, but it had a bunch of stuff that I dont need. Anyways, I am using mount for "stateful components", run reitit routes through ring/jetty + next.jdbc. My question is general. Trying to model it correctly. If I run mount/start -> it will start 3 stateful components (config, dbconn, http). My understanding now leaks a bit, i do not need to run this in seperate threads(the mount/start stuff)? As jetty-adapter has its own threadpool it orchestrates? So the presumed bottleneck might be in dbconn, as I have one for now? So those stateful references are available to jetty threads and for example if jetty threadpool has 50 threads, each will reach for the same db conn?

dpsutton14:01:26

you usually want to set it up so they reach for the same db connection pool and the pool manages some limited number of connections to the db. But often the db connections are fewer than the request threads

rmxm15:01:19

thanks, so my understanding is correct all http threads see the same mount reference? (from main thread?)

donyorm20:01:25

Is there a clojure cli equivalent of lein deps :tree?

Darin Douglass20:01:28

clj -Xdeps tree

seancorfield20:01:19

Strictly speaking it's clj -X:deps tree -- aliases are supposed to start with : so -Xdeps might stop working at some point.

🙌 1
seancorfield20:01:21

If your CLI is up-to-date, clojure -X:deps list can be useful too, listing just the final selected dependencies with their license information if available.

donyorm20:01:20

Thanks that's helpful! For some reason google wasn't bringing this up for me

Lukas22:01:22

Hello clojurians, I'm using tools.build to create an uberjar. This works fine on my local machine, but on my server it fails for some reason. This is the short error message (full message in thread)

syntax error (IllegalArgumentException) compiling new at (lhrb/words/core.clj:210:22).
Unable to resolve classname: GzipHandler
I import the GzipHandler like this (:import [org.eclipse.jetty.server.handler.gzip GzipHandler]) I use on both machines Clojure CLI version 1.10.3.1058 and openjdk 17.0.1 2021-10-19

Lukas22:01:37

{:clojure.main/message
 "Syntax error (IllegalArgumentException) compiling new at (lhrb/words/core.clj:210:22).\nUnable to resolve classname: GzipHandler\n",
 :clojure.main/triage
 {:clojure.error/phase :compile-syntax-check,
  :clojure.error/line 210,
  :clojure.error/column 22,
  :clojure.error/source "core.clj",
  :clojure.error/symbol new,
  :clojure.error/path "lhrb/words/core.clj",
  :clojure.error/class java.lang.IllegalArgumentException,
  :clojure.error/cause "Unable to resolve classname: GzipHandler"},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.Compiler$CompilerException,
    :message
    "Syntax error compiling new at (lhrb/words/core.clj:210:22).",
    :data
    {:clojure.error/phase :compile-syntax-check,
     :clojure.error/line 210,
     :clojure.error/column 22,
     :clojure.error/source "lhrb/words/core.clj",
     :clojure.error/symbol new},
    :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 7119]}
   {:type java.lang.IllegalArgumentException,
    :message "Unable to resolve classname: GzipHandler",
    :at
    [clojure.lang.Compiler$NewExpr$Parser
     parse
     "Compiler.java"
     2667]}],
  :trace
  [[clojure.lang.Compiler$NewExpr$Parser parse "Compiler.java" 2667]
   [clojure.lang.Compiler analyzeSeq "Compiler.java" 7111]
   [clojure.lang.Compiler analyze "Compiler.java" 6793]
   [clojure.lang.Compiler analyzeSeq "Compiler.java" 7099]
   [clojure.lang.Compiler analyze "Compiler.java" 6793]
   [clojure.lang.Compiler access$300 "Compiler.java" 38]
   [clojure.lang.Compiler$LetExpr$Parser parse "Compiler.java" 6388]
   [clojure.lang.Compiler analyzeSeq "Compiler.java" 7111]
   [clojure.lang.Compiler analyze "Compiler.java" 6793]
   [clojure.lang.Compiler analyzeSeq "Compiler.java" 7099]
   [clojure.lang.Compiler analyze "Compiler.java" 6793]
   [clojure.lang.Compiler analyzeSeq "Compiler.java" 7099]
   [clojure.lang.Compiler analyze "Compiler.java" 6793]
   [clojure.lang.Compiler analyze "Compiler.java" 6749]
   [clojure.lang.Compiler$HostExpr$Parser parse "Compiler.java" 1020]
   [clojure.lang.Compiler analyzeSeq "Compiler.java" 7111]
   [clojure.lang.Compiler analyze "Compiler.java" 6793]
   [clojure.lang.Compiler analyzeSeq "Compiler.java" 7099]
   [clojure.lang.Compiler analyze "Compiler.java" 6793]
   [clojure.lang.Compiler analyze "Compiler.java" 6749]
   [clojure.lang.Compiler$BodyExpr$Parser parse "Compiler.java" 6124]
   [clojure.lang.Compiler$FnMethod parse "Compiler.java" 5471]
   [clojure.lang.Compiler$FnExpr parse "Compiler.java" 4033]
   [clojure.lang.Compiler analyzeSeq "Compiler.java" 7109]
   [clojure.lang.Compiler analyze "Compiler.java" 6793]
   [clojure.lang.Compiler analyzeSeq "Compiler.java" 7099]
   [clojure.lang.Compiler analyze "Compiler.java" 6793]
   [clojure.lang.Compiler access$300 "Compiler.java" 38]
   [clojure.lang.Compiler$DefExpr$Parser parse "Compiler.java" 596]
   [clojure.lang.Compiler analyzeSeq "Compiler.java" 7111]
   [clojure.lang.Compiler analyze "Compiler.java" 6793]
   [clojure.lang.Compiler analyze "Compiler.java" 6749]
   [clojure.lang.Compiler compile1 "Compiler.java" 7730]
   [clojure.lang.Compiler compile "Compiler.java" 7802]
   [clojure.lang.RT compile "RT.java" 411]
   [clojure.lang.RT load "RT.java" 457]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6856 invoke "core.clj" 6115]
   [clojure.core$load invokeStatic "core.clj" 6114]
   [clojure.core$load doInvoke "core.clj" 6098]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5897]
   [clojure.core$compile$fn__6861 invoke "core.clj" 6125]
   [clojure.core$compile invokeStatic "core.clj" 6125]
   [clojure.core$compile invoke "core.clj" 6117]
   [user$eval136 invokeStatic "compile.clj" 6]
   [user$eval136 invoke "compile.clj" 1]
   [clojure.lang.Compiler eval "Compiler.java" 7181]
   [clojure.lang.Compiler load "Compiler.java" 7640]
   [clojure.lang.Compiler loadFile "Compiler.java" 7578]
   [clojure.main$load_script invokeStatic "main.clj" 475]
   [clojure.main$script_opt invokeStatic "main.clj" 535]
   [clojure.main$script_opt invoke "main.clj" 530]
   [clojure.main$main invokeStatic "main.clj" 664]
   [clojure.main$main doInvoke "main.clj" 616]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.main main "main.java" 40]],
  :cause "Unable to resolve classname: GzipHandler",
  :phase :compile-syntax-check}}

Alex Miller (Clojure team)22:01:31

Seems like you somehow must not have that Jetty class in the deps basis that's used to compile your uber jar. If you can load your build file and examine the basis you created, it should have a :libs key that is a map of lib name to coordinate. The compile step should leave some of it's work (like a classpath file) in the tmp dir when it fails like this.

Alex Miller (Clojure team)22:01:18

You can either find the tmpdir root with (System/getProperty "java.io.tmpdir") or even set it somewhere you can see with -J-Djava.io.tmpdir=/path on your Clojure CLI command line - whatever the newest subdirectory there is is probably it

Alex Miller (Clojure team)22:01:04

I guess it would be interesting to compare clj -Stree in both envs too to see if they differ

Lukas09:01:24

🙏 thanks a lot for your answer. I'm trying to figure it out.