This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-27
Channels
- # announcements (11)
- # asami (7)
- # babashka (140)
- # beginners (58)
- # calva (12)
- # clj-kondo (5)
- # cljsrn (9)
- # clojure (60)
- # clojure-australia (8)
- # clojure-boston (1)
- # clojure-europe (35)
- # clojure-france (2)
- # clojure-germany (5)
- # clojure-italy (8)
- # clojure-nl (7)
- # clojure-sweden (14)
- # clojure-uk (23)
- # clojurescript (16)
- # community-development (2)
- # cursive (7)
- # datomic (6)
- # docker (1)
- # emacs (4)
- # fulcro (11)
- # graalvm (5)
- # honeysql (6)
- # jobs (6)
- # jobs-discuss (36)
- # lsp (19)
- # malli (7)
- # meander (8)
- # off-topic (18)
- # pathom (16)
- # practicalli (33)
- # re-frame (43)
- # react (2)
- # remote-jobs (11)
- # sci (83)
- # shadow-cljs (55)
- # tools-deps (48)
I was thinking for lein projects, lein has a task to make a compatible pom.xml, but not to make a deps.edn I believe
if you mean how to convert lein -> deps I used https://github.com/hagmonk/depify
What is the proper way of invoking:
clojure -Sforce -A:backend:backend/prod:backend/build -X:backend/build
Can this be squashed into one -X:...
? Of which alias is the exec fn chosen?You can combine, will use the last one iirc
:mvn/local-repo
@alexmiller Is this a documented option? I couldn't find it
It’s part of the deps.edn, not a clj option
If I run clj -M -m
lots of dependencies are downloaded. I thought running clojure -Spath
beforehand would fetch those dependencies, but it doesn’t seem to do so?
No, I think it’s just an oversight
I was trying to find that the other day in response to someone’s new-to-tools-deps question. It would be nice if the docs were also a little clearer that :mvn/repos
and :mvn/local-repo
can only be used at top-level keys and not inside aliases — that seems to be a fairly common confusion for some folks.
:thumbsup:
@simongray I think it would need to fetch those deps in order to calc the classpath, no?
You would think so, but it doesn’t seem to do that. The clojure -Spath
runs inside a Docker container, so perhaps something is amiss
Solved: I didn’t set the WORKDIR in the Dockerfile before running clojure -Spath
so there was no deps.edn
to fetch download depencies according to.
Also, maybe someone can tell me why you need to do -M -m
? Or should I do -X
now instead (the docs seem to use that now)?
Because -M
means “run clojure.main
” and -m
is an option to clojure.main
itself (as are -i
, -e
, and -r
).
was the decision to provide only short-form arguments for clj
deliberate? having better-reading commands would, IMO, alleviate a good portion of the -M
v -X
v -A
mixups.
long-form arguments are definitely not magic pill for this style problem, but after a cursory think, i can't really think of a downside to having them
Because -M
means “run clojure.main
” and -m
is an option to clojure.main
itself (as are -i
, -e
, and -r
).
was the decision to provide only short-form arguments for clj
deliberate? having better-reading commands would, IMO, alleviate a good portion of the -M
v -X
v -A
mixups.
long-form arguments are definitely not magic pill for this style problem, but after a cursory think, i can't really think of a downside to having them
@ddouglass Another option could be having subcommands instead of dashed options.
clojure -A:foo:bar exec <exec-fn>
clojure -A:foo:bar main <foo.bar>
clojure -A:foo:bar path ;; print classpath
clojure -A:foo:bar run <tool>
clojure -A:foo:bar pom ...
so just one option to "compose" the classpath and subcommands that handle what should be done (with their own arg parsing and help output)
ya, i'm more preferential to that option b/c i think the current -A|M|X
options are a bit overloaded which bring up questions (like your's earlier) like "which alias does exec-opts come from", etc.
same thing for -S*
: some are commands (`-Stree`) while some are options (`-Scp cp`)
In the case of
clojure -A:foo:bar exec <exec-fn>
you would still have the ambiguity of where the exec-fn
could come from (the last alias?)It’s not ambiguous - there is a merge strategy defined for each
oh sure, it might be inscrutable :)
but generally I think <hand-wave> last one wins <hand-wave/> is what you expect most
I’m a bit confused about something. I have a deps.edn
with :paths ["src"]
, but clojure.tools.namespace.repl/reset
doesn’t work unless I (clojure.tools.namespace.repl/set-refresh-dirs "src")
. Checking (clojure.java.classpath/classpath-directories)
returns '()
. I guess my expectation was that this would be set using :paths
?
repl is started using cider via /usr/local/bin/clojure -A:dev -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.8.3"} refactor-nrepl/refactor-nrepl {:mvn/version "2.5.1"} cider/cider-nrepl {:mvn/version "0.25.9"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[refactor-nrepl.middleware/wrap-refactor,cider.nrepl/cider-middleware]"]}}}' -M:cider/nrepl
clojure -Spath
prints src:resources:<...rest>
@mail024 My advice would be to try to ween yourself off the t.n.r reset/reload workflow and develop a “better” REPL workflow that doesn’t need that sort of thing, i.e., eval’ing every change you make as you go so the REPL state is always fresh. I see a lot of people get into all sorts of problems with “reloaded” style workflows 😞 and folks like Eric Normand, Stu Halloway, Rich Hickey, myself, and many others avoid this sort of tooling.
(but it does sound like a but in java.classpath
since src
and resources
are on the classpath and are directories — you could create a post on http://ask.clojure.org tagged with the java.classpath
library and see what the library maintainers say)
I would also recommend trying to repro in a plain REPL started yourself — without all that nREPL/CIDER stuff — and see if the problem persists: it’s entirely possible that something in nREPL/CIDER is causing this problem…
@seancorfield Thanks. Appreciate the advice. Guess it’s an old habit. Will give the suggested approach a spin, been meaning to try life without ns refresh for a while now
I’m thinking it might actually be a cider thing. plain repl has the expected entries in classpath-directories
I haven’t used nREPL or CIDER for a very long time so I would only point you to #cider at this point 🙂
(I use a plain Socket REPL with no additional dependencies)